Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05faefb301 | ||
|
|
82ffc7c3fd | ||
|
|
91d5ab6352 | ||
|
|
16b695200a | ||
|
|
369bbe4d72 | ||
|
|
17dbc747ba | ||
|
|
4888195566 | ||
|
|
a38cf6304e |
No files matched your search
@@ -38,6 +38,8 @@ $(document).ready(function() {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$('.page_footer').append($('#last_update_date')[0]);
|
||||
});
|
||||
// Ad Banner FX code [end]
|
||||
|
||||
@@ -1,573 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
require 'net/http'
|
||||
require 'open-uri'
|
||||
|
||||
class Admin::ImportDataController < OrbitBackendController
|
||||
helper Admin::PagePartsHelper
|
||||
include Admin::FrontendWidgetInterface
|
||||
|
||||
def get_teacher_data
|
||||
uri = URI("https://localhost:8000/teachers.xml")
|
||||
|
||||
#params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
|
||||
#uri.query = URI.encode_www_form(params)
|
||||
res = Net::HTTP.get_response(uri)
|
||||
|
||||
@teacher_data = Hash.from_xml(res.body)
|
||||
@teachers = @teacher_data["objects"]
|
||||
@i = 5000
|
||||
@teachers.each do |hash|
|
||||
# @roles = Role.skip(1).first
|
||||
@roles = Role.all
|
||||
@teacher = User.new
|
||||
I18n.locale = :zh_tw
|
||||
if !hash['teacher_zh_tw'].blank?
|
||||
@teacher.first_name = hash['teacher_zh_tw']
|
||||
elsif hash['teacher_zh_tw'].blank? && !hash['teacher_en'].blank?
|
||||
@teacher.first_name = hash['teacher_en']
|
||||
elsif hash['teacher_zh_tw'].blank? && hash['teacher_en'].blank?
|
||||
@teacher.first_name = "Please Fill the Name"
|
||||
end
|
||||
|
||||
I18n.locale = :en
|
||||
if !hash['teacher_en'].blank?
|
||||
@teacher.first_name = hash['teacher_en']
|
||||
elsif hash['teacher_en'].blank? && !hash['teacher_zh_tw'].blank?
|
||||
@teacher.first_name = hash['teacher_zh_tw']
|
||||
elsif hash['teacher_en'].blank? && hash['teacher_zh_tw'].blank?
|
||||
@teacher.first_name = "Please Fill the Name"
|
||||
end
|
||||
|
||||
#@teacher.first_name = hash['teacher_en']
|
||||
@teacher.ntu_seq = hash['ntu_seq']
|
||||
@teacher.sid = hash['ntu_seq']
|
||||
@teacher.role_ids = ["#{@roles.skip(1).first.id}"]
|
||||
@teacher.password = "testpass"
|
||||
@i += 10
|
||||
if !hash['email'].blank?
|
||||
@user = User.where(email: "#{hash['email']}")
|
||||
if @user.length == 0
|
||||
@teacher.email = hash['email']
|
||||
elsif @user.length > 0
|
||||
@teacher.email = "#{@i}duplicate@ntu.edu.tw"
|
||||
end
|
||||
else
|
||||
@teacher.email = "#{@i}@ntu.edu.tw"
|
||||
end
|
||||
|
||||
if hash['teacher_zh_tw'].blank? && hash['teacher_en'].blank?
|
||||
@teacher.user_id = "defaultuser"
|
||||
elsif hash['teacher_en'].blank?
|
||||
@teacher.user_id = hash['teacher_zh_tw']
|
||||
elsif hash['teacher_zh_tw']
|
||||
@teacher.user_id = hash['teacher_en']
|
||||
end
|
||||
@teacher.save!
|
||||
end
|
||||
end
|
||||
|
||||
def get_book_data
|
||||
uri = URI("http://ann.cc.ntu.edu.tw/Achv/xmlTeacherData.asp")
|
||||
params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
|
||||
uri.query = URI.encode_www_form(params)
|
||||
res = Net::HTTP.get_response(uri)
|
||||
|
||||
teachers = User.all
|
||||
|
||||
teachers.each do |hash|
|
||||
if hash.sid.present?
|
||||
ntu_seq = hash.sid
|
||||
books_xml = Nokogiri::XML( \
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlBook.asp?Seq=#{ntu_seq}"))
|
||||
@books = books_xml.xpath("//Book").map do |book_node|
|
||||
{
|
||||
author: (book_node>"Authors").text,
|
||||
year: (book_node>"PublishYear").text,
|
||||
title: (book_node>"DocTitle").text,
|
||||
remarks: (book_node>"Remarks").text,
|
||||
publisher: (book_node>"Publisher").text,
|
||||
book_title: (book_node>"BookTitle").text
|
||||
}
|
||||
end
|
||||
if @books.present?
|
||||
@books.each do |b|
|
||||
@book = WritingBook.new
|
||||
I18n.locale = :zh_tw
|
||||
@book.authors = b[:author]
|
||||
@book.paper_title = b[:title]
|
||||
@book.book_title = b[:book_title]
|
||||
@book.note = b[:remarks]
|
||||
@book.publisher = b[:publisher]
|
||||
I18n.locale = :en
|
||||
@book.authors = b[:author]
|
||||
@book.paper_title = b[:title]
|
||||
@book.book_title = b[:book_title]
|
||||
@book.note = b[:remarks]
|
||||
@book.publisher = b[:publisher]
|
||||
@book.year = b[:year]
|
||||
@book.create_user_id = hash.id
|
||||
@book.save
|
||||
end
|
||||
else
|
||||
puts "No books by Teacher"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_conference_data
|
||||
uri = URI("http://ann.cc.ntu.edu.tw/Achv/xmlTeacherData.asp")
|
||||
params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
|
||||
uri.query = URI.encode_www_form(params)
|
||||
res = Net::HTTP.get_response(uri)
|
||||
|
||||
teachers = User.all
|
||||
|
||||
teachers.each do |hash|
|
||||
if hash.sid.present?
|
||||
ntu_seq = hash.sid
|
||||
conference_xml = Nokogiri::XML( \
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=C"))
|
||||
#open("http://versatile.management.ntu.edu.tw/publication1/conference/#{ntuseq}.xml"))
|
||||
@conference_papers = conference_xml.xpath("//Paper").map do |cp_node|
|
||||
{
|
||||
author: (cp_node>"Authors").text,
|
||||
year: (cp_node>"PublishYear").text,
|
||||
title: (cp_node>"PaperTitle").text,
|
||||
conference: (cp_node>"PublishOn").text,
|
||||
date: Date::MONTHNAMES[(cp_node>"PublishMonth").text.to_i],
|
||||
location: "#{(cp_node>"Country").text} #{(cp_node>"location").text}",
|
||||
conference_title: (cp_node>"PublishOn").text,
|
||||
remarks: (cp_node>"Remarks").text
|
||||
}
|
||||
end
|
||||
if @conference_papers.present?
|
||||
@conference_papers.each do |b|
|
||||
@conference_paper = WritingConference.new
|
||||
I18n.locale = :zh_tw
|
||||
@conference_paper.authors = b[:author]
|
||||
if b[:title].blank?
|
||||
@conference_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.paper_title = b[:title]
|
||||
end
|
||||
if b[:conference_title].blank?
|
||||
@conference_paper.conference_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.conference_title = b[:conference_title]
|
||||
end
|
||||
|
||||
@conference_paper.note = b[:remarks]
|
||||
I18n.locale = :en
|
||||
@conference_paper.authors = b[:author]
|
||||
if b[:title].blank?
|
||||
@conference_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.paper_title = b[:title]
|
||||
end
|
||||
if b[:conference_title].blank?
|
||||
@conference_paper.conference_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.conference_title = b[:conference_title]
|
||||
end
|
||||
@conference_paper.note = b[:remarks]
|
||||
|
||||
@conference_paper.location = b[:location]
|
||||
@conference_paper.year = b[:year]
|
||||
@conference_paper.create_user_id = hash.id
|
||||
|
||||
@conference_paper.save!
|
||||
end
|
||||
else
|
||||
puts "No conference by Teacher"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def get_journal_paper_data
|
||||
uri = URI("http://ann.cc.ntu.edu.tw/Achv/xmlTeacherData.asp")
|
||||
params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
|
||||
uri.query = URI.encode_www_form(params)
|
||||
res = Net::HTTP.get_response(uri)
|
||||
|
||||
teachers = User.all
|
||||
|
||||
teachers.each do |hash|
|
||||
if hash.sid.present?
|
||||
ntu_seq = hash.sid
|
||||
paper_xml = Nokogiri::XML( \
|
||||
#open("http://versatile.management.ntu.edu.tw/publication1/journal/#{ntuseq}.xml"))
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=J"))
|
||||
@journal_papers = paper_xml.xpath("//Paper").map do |paper_node|
|
||||
{
|
||||
author: (paper_node>"Authors").text,
|
||||
year: (paper_node>"PublishYear").text,
|
||||
title: (paper_node>"PaperTitle").text,
|
||||
journal: (paper_node>"PublishOn").text,
|
||||
volume:(paper_node>"Volume").text,
|
||||
volumeno:(paper_node>"VolumeNo").text,
|
||||
beginpage:(paper_node>"BeginPage").text,
|
||||
endpage:(paper_node>"EndPage").text,
|
||||
subgroup:(paper_node>"subgroup").text,
|
||||
remarks: (paper_node>"Remarks").text,
|
||||
cate: ((paper_node>"subgroup")>"Group").text
|
||||
}
|
||||
end
|
||||
if @journal_papers.present?
|
||||
@journal_papers.each do |b|
|
||||
@journal_paper = WritingJournal.new
|
||||
I18n.locale = :zh_tw
|
||||
@journal_paper.authors = b[:author]
|
||||
if b[:title].blank?
|
||||
@journal_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@journal_paper.paper_title = b[:title]
|
||||
end
|
||||
@journal_paper.journal_title = b[:journal]
|
||||
@journal_paper.note = b[:remarks]
|
||||
I18n.locale = :en
|
||||
@journal_paper.authors = b[:author]
|
||||
if b[:title].blank?
|
||||
@journal_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@journal_paper.paper_title = b[:title]
|
||||
end
|
||||
@journal_paper.journal_title = b[:journal]
|
||||
@journal_paper.note = b[:remarks]
|
||||
@journal_paper.year = b[:year]
|
||||
@journal_paper.vol_no = b[:volumeno]
|
||||
@journal_paper.form_to_start = b[:beginpage]
|
||||
@journal_paper.form_to_end = b[:endpage]
|
||||
if !b[:cate].blank?
|
||||
@level_type = JournalLevelType.where(:key => b[:cate])
|
||||
if @level_type.present?
|
||||
@journal_paper.journal_level_type_ids = ["#{@level_type.first.id}"]
|
||||
end
|
||||
end
|
||||
|
||||
@journal_paper.create_user_id = hash.id
|
||||
@journal_paper.save!
|
||||
end
|
||||
else
|
||||
puts "No journal paper by Teacher"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def sync_conference_data
|
||||
@conference_data = WritingConference.where(create_user_id: "#{params[:user_id]}")
|
||||
@conference_data.delete_all
|
||||
@user = User.find("#{params[:user_id]}")
|
||||
|
||||
# teachers.each do |hash|
|
||||
if @user.sid.present?
|
||||
ntu_seq = @user.sid
|
||||
conference_xml = Nokogiri::XML( \
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=C"))
|
||||
#open("http://versatile.management.ntu.edu.tw/publication1/conference/#{ntuseq}.xml"))
|
||||
@conference_papers = conference_xml.xpath("//Paper").map do |cp_node|
|
||||
{
|
||||
author: (cp_node>"Authors").text,
|
||||
year: (cp_node>"PublishYear").text,
|
||||
title: (cp_node>"PaperTitle").text,
|
||||
conference: (cp_node>"PublishOn").text,
|
||||
date: Date::MONTHNAMES[(cp_node>"PublishMonth").text.to_i],
|
||||
location: "#{(cp_node>"Country").text} #{(cp_node>"location").text}",
|
||||
conference_title: (cp_node>"PublishOn").text,
|
||||
remarks: (cp_node>"Remarks").text
|
||||
}
|
||||
end
|
||||
if @conference_papers.present?
|
||||
@conference_papers.each do |b|
|
||||
@conference_paper = WritingConference.new
|
||||
I18n.locale = :zh_tw
|
||||
@conference_paper.authors = b[:author]
|
||||
if b[:title].blank?
|
||||
@conference_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.paper_title = b[:title]
|
||||
end
|
||||
if b[:conference_title].blank?
|
||||
@conference_paper.conference_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.conference_title = b[:conference_title]
|
||||
end
|
||||
|
||||
@conference_paper.note = b[:remarks]
|
||||
I18n.locale = :en
|
||||
@conference_paper.authors = b[:author]
|
||||
if b[:title].blank?
|
||||
@conference_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.paper_title = b[:title]
|
||||
end
|
||||
if b[:conference_title].blank?
|
||||
@conference_paper.conference_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.conference_title = b[:conference_title]
|
||||
end
|
||||
@conference_paper.note = b[:remarks]
|
||||
|
||||
@conference_paper.location = b[:location]
|
||||
@conference_paper.year = b[:year]
|
||||
@conference_paper.create_user_id = @user.id
|
||||
|
||||
@conference_paper.save!
|
||||
end
|
||||
else
|
||||
puts "No conference by Teacher"
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
|
||||
format.html
|
||||
format.json { render json: {"success"=>true}.to_json}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def sync_journal_paper_data
|
||||
@journal_data = WritingJournal.where(create_user_id: "#{params[:user_id]}")
|
||||
@journal_data.delete_all
|
||||
@user = User.find("#{params[:user_id]}")
|
||||
|
||||
# teachers.each do |hash|
|
||||
if @user.sid.present?
|
||||
ntu_seq = @user.sid
|
||||
paper_xml = Nokogiri::XML( \
|
||||
#open("http://versatile.management.ntu.edu.tw/publication1/journal/#{ntuseq}.xml"))
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=J"))
|
||||
@journal_papers = paper_xml.xpath("//Paper").map do |paper_node|
|
||||
{
|
||||
author: (paper_node>"Authors").text,
|
||||
year: (paper_node>"PublishYear").text,
|
||||
title: (paper_node>"PaperTitle").text,
|
||||
journal: (paper_node>"PublishOn").text,
|
||||
volume:(paper_node>"Volume").text,
|
||||
volumeno:(paper_node>"VolumeNo").text,
|
||||
beginpage:(paper_node>"BeginPage").text,
|
||||
endpage:(paper_node>"EndPage").text,
|
||||
subgroup:(paper_node>"subgroup").text,
|
||||
remarks: (paper_node>"Remarks").text,
|
||||
cate: ((paper_node>"subgroup")>"Group").text
|
||||
}
|
||||
end
|
||||
if @journal_papers.present?
|
||||
@journal_papers.each do |b|
|
||||
@journal_paper = WritingJournal.new
|
||||
I18n.locale = :zh_tw
|
||||
@journal_paper.authors = b[:author]
|
||||
|
||||
if b[:title].blank?
|
||||
@journal_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@journal_paper.paper_title = b[:title]
|
||||
end
|
||||
|
||||
@journal_paper.journal_title = b[:journal]
|
||||
@journal_paper.note = b[:remarks]
|
||||
I18n.locale = :en
|
||||
@journal_paper.authors = b[:author]
|
||||
|
||||
if b[:title].blank?
|
||||
@journal_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@journal_paper.paper_title = b[:title]
|
||||
end
|
||||
|
||||
@journal_paper.journal_title = b[:journal]
|
||||
@journal_paper.note = b[:remarks]
|
||||
@journal_paper.year = b[:year]
|
||||
@journal_paper.vol_no = b[:volumeno]
|
||||
@journal_paper.form_to_start = b[:beginpage]
|
||||
@journal_paper.form_to_end = b[:endpage]
|
||||
|
||||
if !b[:cate].blank?
|
||||
@level_type = JournalLevelType.where(:key => b[:cate])
|
||||
if @level_type.present?
|
||||
@journal_paper.journal_level_type_ids = ["#{@level_type.first.id}"]
|
||||
end
|
||||
end
|
||||
|
||||
@journal_paper.create_user_id = @user.id
|
||||
@journal_paper.save!
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
respond_to do |format|
|
||||
|
||||
format.html
|
||||
format.json { render json: {"success"=>true}.to_json}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def sync_book_data
|
||||
@books_data = WritingBook.where(create_user_id: "#{params[:user_id]}")
|
||||
@books_data.delete_all
|
||||
@user = User.find("#{params[:user_id]}")
|
||||
|
||||
# teachers.each do |hash|
|
||||
if @user.sid.present?
|
||||
ntu_seq = @user.sid
|
||||
books_xml = Nokogiri::XML( \
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlBook.asp?Seq=#{ntu_seq}"))
|
||||
@books = books_xml.xpath("//Book").map do |book_node|
|
||||
{
|
||||
author: (book_node>"Authors").text,
|
||||
year: (book_node>"PublishYear").text,
|
||||
title: (book_node>"DocTitle").text,
|
||||
remarks: (book_node>"Remarks").text,
|
||||
publisher: (book_node>"Publisher").text,
|
||||
book_title: (book_node>"BookTitle").text
|
||||
}
|
||||
end
|
||||
if @books.present?
|
||||
@books.each do |b|
|
||||
@book = WritingBook.new
|
||||
I18n.locale = :zh_tw
|
||||
@book.authors = b[:author]
|
||||
@book.paper_title = b[:title]
|
||||
@book.book_title = b[:book_title]
|
||||
@book.note = b[:remarks]
|
||||
@book.publisher = b[:publisher]
|
||||
I18n.locale = :en
|
||||
@book.authors = b[:author]
|
||||
@book.paper_title = b[:title]
|
||||
@book.book_title = b[:book_title]
|
||||
@book.note = b[:remarks]
|
||||
@book.publisher = b[:publisher]
|
||||
@book.year = b[:year]
|
||||
@book.create_user_id = @user.id
|
||||
@book.save
|
||||
end
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
|
||||
format.html
|
||||
format.json { render json: {"success"=>true}.to_json}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def get_announcement_data
|
||||
uri = URI("https://localhost:8000/announcements.xml")
|
||||
|
||||
#params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
|
||||
#uri.query = URI.encode_www_form(params)
|
||||
res = Net::HTTP.get_response(uri)
|
||||
|
||||
@announcement_data = Hash.from_xml(res.body)
|
||||
@announcements = @announcement_data["objects"]
|
||||
@announcements.each do |hash|
|
||||
@bulletin = Bulletin.new
|
||||
|
||||
I18n.locale = :zh_tw
|
||||
if hash['announcement_title_zh_tw'].blank?
|
||||
@bulletin.title = hash['announcement_title_en']
|
||||
@bulletin.text = hash['announcement_content_zh_tw']
|
||||
elsif hash['announcement_title_zh_tw'].blank? && hash['announcement_title_en'].blank?
|
||||
@bulletin.title = "Please Fill the Name"
|
||||
@bulletin.text = hash['announcement_content_zh_tw']
|
||||
else
|
||||
@bulletin.title = hash['announcement_title_zh_tw']
|
||||
@bulletin.text = hash['announcement_content_zh_tw']
|
||||
end
|
||||
|
||||
I18n.locale = :en
|
||||
if hash['announcement_title_zh_tw'].blank? && hash['announcement_title_en'].blank?
|
||||
@bulletin.title = "Please Fill the Name"
|
||||
@bulletin.text = hash['announcement_content_en']
|
||||
|
||||
elsif hash['announcement_title_en'].blank?
|
||||
@bulletin.title = hash['announcement_zh_tw']
|
||||
@bulletin.text = hash['announcement_content_en']
|
||||
|
||||
elsif hash['announcement_title_zh_tw'].blank?
|
||||
@bulletin.title = hash['announcement_title_en']
|
||||
@bulletin.text = hash['announcement_content_en']
|
||||
end
|
||||
@bulletin.category_id = "51d2a16438178423c2000001"
|
||||
@bulletin.is_pending = true
|
||||
|
||||
@bulletin.save!
|
||||
end
|
||||
end
|
||||
|
||||
def get_page_data
|
||||
f = File.open("/home/rwub/orbit-db/ntu_mb/pages/management_pages.xml")
|
||||
page_xml = Nokogiri::XML(f)
|
||||
#open("http://versatile.management.ntu.edu.tw/publication1/conference/#{ntuseq}.xml"))
|
||||
@pages = page_xml.xpath("//management-page").map do |cp_node|
|
||||
{
|
||||
menu_title: (cp_node>"menu-title").text,
|
||||
content: (cp_node>"content").text
|
||||
}
|
||||
end
|
||||
|
||||
if @pages.present?
|
||||
@i=0
|
||||
@pages.each do |b|
|
||||
|
||||
get_variables_for_new
|
||||
@page = Page.new
|
||||
|
||||
@page.parent = "4f45f3b9e9d02c5db900005d"
|
||||
@page.design = "50ac424983e75219d2000021"
|
||||
@page.theme_id = "50ac424a83e75219d2000025"
|
||||
@page.menu_enabled_for= ["en", "zh_tw", ""]
|
||||
@page.enabled_for= ["en", "zh_tw", ""]
|
||||
@page.is_published = false
|
||||
if b[:menu_title].blank?
|
||||
@page.title = 'No Title Present'
|
||||
@i += 1
|
||||
@page.name = "#{@i}Page"
|
||||
else
|
||||
@i += 1
|
||||
@page.title = b[:menu_title]
|
||||
@page.name = "#{@i}Page"
|
||||
end
|
||||
if b[:content].blank?
|
||||
@page.content = "No Content Present"
|
||||
else
|
||||
@page.content = b[:content]
|
||||
end
|
||||
@page.save!
|
||||
end
|
||||
else
|
||||
puts "No Page Data"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def get_variables_for_new
|
||||
@designs = Design.all.entries
|
||||
@themes = Design.first.themes
|
||||
@module_apps = ModuleApp.for_frontend_select
|
||||
@app_frontend_urls = nil
|
||||
@categories = nil
|
||||
@tags = nil
|
||||
@page_frontend_data_counts = nil
|
||||
@frontend_styles = nil
|
||||
@selected={
|
||||
:design => @designs.first,
|
||||
:theme=> @themes.first,
|
||||
:module_app=>nil,#@module_apps.first
|
||||
:app_frontend_url=> nil, #@module_apps.first
|
||||
:category=>nil,
|
||||
:tag=>nil,
|
||||
:page_frontend_data_count=>nil,
|
||||
:frontend_style => nil
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -238,7 +238,7 @@ class ApplicationController < ActionController::Base
|
||||
redirect_to ret
|
||||
end
|
||||
|
||||
def get_sorted_and_filtered(object_class, query = nil, objects = nil)
|
||||
def get_sorted_and_filtered(object_class, query = nil, objects = nil, pagination = true)
|
||||
if params[:filter] || params[:sort] || params[:new_filter]
|
||||
@filter = params[:filter]
|
||||
new_filter = params[:new_filter]
|
||||
@@ -346,7 +346,11 @@ class ApplicationController < ActionController::Base
|
||||
objects = get_bulletins_for_open_backend(objects)
|
||||
end
|
||||
|
||||
Kaminari.paginate_array(filter_authorized_objects(objects)).page(params[:page]).per(10)
|
||||
if pagination
|
||||
Kaminari.paginate_array(filter_authorized_objects(objects)).page(params[:page]).per(10)
|
||||
else
|
||||
filter_authorized_objects(objects)
|
||||
end
|
||||
end
|
||||
|
||||
def get_bulletins_for_open_backend(objects)
|
||||
|
||||
@@ -40,6 +40,7 @@ class DefaultWidgetController< OrbitWidgetController
|
||||
|
||||
def default_widget
|
||||
@search = params["search_query"].blank? ? false : true
|
||||
|
||||
if !params[:id].blank? and !params["clicked_field_name"].blank?
|
||||
clicked_field_name = params["clicked_field_name"].to_sym
|
||||
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})")
|
||||
@@ -69,7 +70,10 @@ class DefaultWidgetController< OrbitWidgetController
|
||||
@data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
|
||||
end
|
||||
|
||||
if @paginate || @search
|
||||
if params[:filter_category_id] and !params[:filter_category_id].blank?
|
||||
@data = get_filter_data.page(params[:page_main]).per(@data_limit)
|
||||
|
||||
elsif @paginate || @search
|
||||
if @search
|
||||
@data = search_result.page(params[:page_main]).per(@data_limit) rescue []
|
||||
else #regular listing
|
||||
@@ -93,6 +97,18 @@ class DefaultWidgetController< OrbitWidgetController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_filter_data
|
||||
model = @default_widget["query"].classify.constantize
|
||||
if params[:filter_category_id].is_a? Array
|
||||
data = model.where(:category_id.in => params[:filter_category_id])
|
||||
elsif params[:filter_category_id].is_a? String
|
||||
data = model.where(:category_id => params[:filter_category_id])
|
||||
end
|
||||
data.available_for_lang(I18n.locale).can_display.desc(:is_top, :postdate)
|
||||
end
|
||||
|
||||
|
||||
|
||||
def get_category_field_name
|
||||
@ori_class_name = @ori_class_name.constantize
|
||||
|
||||
@@ -7,7 +7,7 @@ class MobileController < ApplicationController
|
||||
def index
|
||||
date_now = Time.now
|
||||
@bulletins = Bulletin.all.available_for_lang(I18n.locale).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(15)
|
||||
@ad_banner = AdBanner.where(title: "Banner")[0]
|
||||
@ad_banner = AdBanner.find(:all, :conditions => {:title => /Home/i})[0]
|
||||
end
|
||||
|
||||
def announcement
|
||||
|
||||
@@ -2,6 +2,7 @@ class PagesController < ApplicationController
|
||||
include ApplicationHelper
|
||||
before_filter :get_item, :only => [:index_from_link, :show_from_link]
|
||||
before_filter :check_frontend_open, :only => [:index,:show]
|
||||
before_filter :get_last_update_date, :only => [:index,:show]
|
||||
# caches_page :index
|
||||
|
||||
def index
|
||||
@@ -64,23 +65,25 @@ class PagesController < ApplicationController
|
||||
url = "/#{@item.path}"
|
||||
options = ''
|
||||
options << "#{options.blank? ? '?' : '&'}page_main=#{params[:page_main]}" unless params[:page_main].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}click=#{params[:click]}" unless params[:click].blank?
|
||||
# options << "#{options.blank? ? '?' : '&'}part_id=#{params[:page_part_id]}" unless params[:page_part_id].blank?
|
||||
|
||||
if params[:category_id].is_a? Array
|
||||
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('category_id',params[:category_id])}" unless params[:category_id].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('filter_category_id',params[:category_id])}" unless params[:category_id].blank?
|
||||
elsif params[:category_id].is_a? String
|
||||
options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}filter_category_id=#{params[:category_id]}" unless params[:category_id].blank?
|
||||
end
|
||||
|
||||
if params[:tag_id].is_a? Array
|
||||
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('tag_id',params[:tag_id])}" unless params[:tag_id].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('filter_tag_id',params[:tag_id])}" unless params[:tag_id].blank?
|
||||
elsif params[:category_id].is_a? String
|
||||
options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}filter_tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
|
||||
end
|
||||
|
||||
|
||||
options << "#{options.blank? ? '?' : '&'}search_query=#{params[:search_query]}" unless params[:search_query].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}name=#{params[:name]}" unless params[:name].blank?
|
||||
uri = URI::escape(url + options)
|
||||
# uri = URI::escape(url + options)
|
||||
uri = url + options
|
||||
#uri = URI::escape("#{url}?" + params.collect{|k,v| "#{k}=#{v}"}.join('&'))
|
||||
redirect_to(uri)unless save_from_no_lang_for_page
|
||||
end
|
||||
@@ -94,6 +97,7 @@ class PagesController < ApplicationController
|
||||
options << "#{options.blank? ? '?' : '&'}preview=#{params[:preview]}" unless params[:preview].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}controller_action=#{params[:controller_action]}" unless params[:controller_action].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}clicked_field_name=#{params[:clicked_field_name]}" unless params[:clicked_field_name].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}image_id=#{params[:image_id]}" unless params[:image_id].blank?
|
||||
redirect_to(url + options) unless save_from_no_lang_for_page
|
||||
end
|
||||
|
||||
@@ -105,26 +109,93 @@ class PagesController < ApplicationController
|
||||
protected
|
||||
|
||||
def get_item
|
||||
# if params[:page_id]
|
||||
# @item = Item.find(params[:page_id])
|
||||
# elsif params[:same_page_id]
|
||||
# @item = Item.find(params[:same_page_id])
|
||||
# else
|
||||
# category_ids = Array(params[:category_id]) unless params[:category_id].nil?
|
||||
# tag_ids = Array(params[:tag_id]) unless params[:tag_id].nil?
|
||||
# module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
||||
|
||||
# default_query = { is_published: true, module_app_id: module_app.id, :app_frontend_url.in => [params[:app_action], 'default_widget'] }
|
||||
# specific_categories = { :category => category_ids }
|
||||
# in_categories = { :category.in => category_ids }
|
||||
# nil_categories = { :category.in => [nil, []] }
|
||||
# specific_tags = { :tag => tag_ids }
|
||||
# in_tags = { :tag.in => tag_ids }
|
||||
# nil_tags = { :tag.in => [nil, []] }
|
||||
|
||||
# if !category_ids.blank? && !tag_ids.blank?
|
||||
# @item = Item.where(default_query.merge(specific_categories).merge(specific_tags)).first
|
||||
# @item = Item.where(default_query.merge(specific_categories).merge(in_tags)).first unless @item
|
||||
# @item = Item.where(default_query.merge(specific_categories).merge(nil_tags)).first unless @item
|
||||
# @item = Item.where(default_query.merge(specific_tags).merge(in_categories)).first unless @item
|
||||
# @item = Item.where(default_query.merge(specific_tags).merge(nil_categories)).first unless @item
|
||||
# @item = Item.where(default_query.merge(in_categories).merge(in_tags)).first unless @item
|
||||
# @item = Item.where(default_query.merge(in_categories).merge(nil_tags)).first unless @item
|
||||
# @item = Item.where(default_query.merge(in_tags).merge(nil_categories)).first unless @item
|
||||
# elsif !category_ids.blank?
|
||||
# @item = Item.where(default_query.merge(specific_categories).merge(nil_tags)).first
|
||||
# @item = Item.where(default_query.merge(specific_categories)).first unless @item
|
||||
# @item = Item.where(default_query.merge(in_categories).merge(nil_tags)).first unless @item
|
||||
# @item = Item.where(default_query.merge(in_categories)).first unless @item
|
||||
# elsif !tag_ids.blank?
|
||||
# @item = Item.where(default_query.merge(specific_tags).merge(nil_categories)).first
|
||||
# @item = Item.where(default_query.merge(specific_tags)).first unless @item
|
||||
# @item = Item.where(default_query.merge(in_tags).merge(nil_categories)).first unless @item
|
||||
# @item = Item.where(default_query.merge(in_tags)).first unless @item
|
||||
# end
|
||||
# @item = Item.find(params[:orig_page]) unless @item || params[:orig_page].blank?
|
||||
# @item = Item.where(default_query.merge(nil_categories).merge(nil_tags)).first unless @item
|
||||
# @item = Item.where(default_query).first unless @item
|
||||
# end
|
||||
# raise PageError, 'Missing Frontend Page' if @item.nil?
|
||||
|
||||
# if params[:page_id]
|
||||
# @item = Item.find(params[:page_id])
|
||||
# elsif params[:same_page_id]
|
||||
# @item = Item.find(params[:same_page_id])
|
||||
# else
|
||||
# category_ids = params[:category_id].is_a?(Array) ? params[:category_id] : [params[:category_id]]
|
||||
# tag_ids = params[:tag_id].is_a?(Array) ? params[:tag_id] : [params[:tag_id]]
|
||||
# module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
||||
# if !category_ids.blank? && !tag_ids.blank?
|
||||
# @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category.in => category_ids, :tag.in => tag_ids})
|
||||
# @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category.in => category_ids, :tag.in => [nil, []]}) unless @item
|
||||
# elsif !category_ids.blank?
|
||||
# @item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], :category.in => category_ids).any_in(tag: [nil, []]).first
|
||||
# elsif !tag_ids.blank?
|
||||
# @item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], :tag.in => tag_ids).any_in(category: [nil, []]).first
|
||||
# end
|
||||
# @item = Item.find(params[:orig_page]) unless @item || params[:orig_page].blank?
|
||||
# @item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).all_of("tag" => {"$in" => [nil, []]},"category" => { "$in" => [nil, []]}).first unless @item
|
||||
# # @item = Item.root.children.where(:module_app_id => module_app.id).first
|
||||
# @item = Item.where(module_app_id: module_app.id, app_frontend_url: 'default_widget').first unless @item
|
||||
# @item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).first unless @item
|
||||
# end
|
||||
# raise PageError,'Missing Frontend Page' if @item.nil?
|
||||
|
||||
if params[:page_id]
|
||||
@item = Item.find(params[:page_id])
|
||||
elsif params[:same_page_id]
|
||||
@item = Item.find(params[:same_page_id])
|
||||
else
|
||||
category_ids = params[:category_id].is_a?(Array) ? params[:category_id] : [params[:category_id]]
|
||||
tag_ids = params[:tag_id].is_a?(Array) ? params[:tag_id] : [params[:tag_id]]
|
||||
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
||||
if !category_ids.blank? && !tag_ids.blank?
|
||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category.in => category_ids, :tag.in => tag_ids})
|
||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category.in => category_ids, :tag.in => [nil, []]}) unless @item
|
||||
elsif !category_ids.blank?
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], :category.in => category_ids).any_in(tag: [nil, []]).first
|
||||
elsif !tag_ids.blank?
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], :tag.in => tag_ids).any_in(category: [nil, []]).first
|
||||
category_ids = params[:category_id] ? (params[:category_id].is_a?(Array) ? params[:category_id] : [params[:category_id]]) : []
|
||||
tag_ids = params[:tag_id].is_a?(Array) ? params[:tag_id] : [params[:tag_id]]
|
||||
|
||||
if !category_ids.blank?
|
||||
@item = Item.where(:category => category_ids).first
|
||||
else
|
||||
if params[:action] && params[:action] == "show_from_link"
|
||||
model = params[:app_action].classify.constantize
|
||||
item = model.find(params[:id])
|
||||
@item = Item.where(:category => [item.category_id.to_s]).first
|
||||
end
|
||||
end
|
||||
@item = Item.find(params[:orig_page]) unless @item || params[:orig_page].blank?
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).all_of("tag" => {"$in" => [nil, []]},"category" => { "$in" => [nil, []]}).first unless @item
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: 'default_widget').first unless @item
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).first unless @item
|
||||
|
||||
@item = Item.root.children.where(:module_app_id => module_app.id).first unless @item
|
||||
end
|
||||
raise PageError,'Missing Frontend Page' if @item.nil?
|
||||
end
|
||||
@@ -144,4 +215,8 @@ class PagesController < ApplicationController
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def get_last_update_date
|
||||
@last_update_date = t(:total_visitors)+' : '+ Impression.count.to_s+' | '+t(:update_at)+' : '+Bulletin.order_by(:updated_at.desc).limit(1).first[:updated_at].to_s
|
||||
end
|
||||
end
|
||||
@@ -1 +0,0 @@
|
||||
<p>Successfully Imported Announcement Data!</p>
|
||||
@@ -1 +0,0 @@
|
||||
<p>Successfully Book Data!</p>
|
||||
@@ -1 +0,0 @@
|
||||
<p>Successfully Conference Data!</p>
|
||||
@@ -1 +0,0 @@
|
||||
<p>Successfully Journal Paper Data!</p>
|
||||
@@ -1 +0,0 @@
|
||||
<p>Successfully Imported Page Data!</p>
|
||||
@@ -1 +0,0 @@
|
||||
<p>Successfully Imported Teacher Data!</p>
|
||||
@@ -1 +0,0 @@
|
||||
<p>Book Data Synced Successfully!</p>
|
||||
@@ -1 +0,0 @@
|
||||
<p>Conference Paper Data Synced Successfully!</p>
|
||||
@@ -1 +0,0 @@
|
||||
<p>Journal Paper Data Synced Successfully!</p>
|
||||
@@ -41,5 +41,6 @@
|
||||
}
|
||||
</style>
|
||||
<% end %>
|
||||
<div id='last_update_date_wrap' style='display:none;'><div id='last_update_date'><%= @last_update_date %></div></div>
|
||||
</body>
|
||||
</html>
|
||||
+5
-3
@@ -8,11 +8,13 @@ defaults: &defaults
|
||||
|
||||
development:
|
||||
<<: *defaults
|
||||
database: test_site
|
||||
database: orbit_site_new
|
||||
|
||||
|
||||
|
||||
test:
|
||||
<<: *defaults
|
||||
database: test_site
|
||||
database: orbit_site_new
|
||||
|
||||
# set these environment variables on your prod server
|
||||
production:
|
||||
@@ -22,4 +24,4 @@ production:
|
||||
# password: <%= ENV['MONGOID_PASSWORD'] %>
|
||||
# database: <%= ENV['MONGOID_DATABASE'] %>
|
||||
<<: *defaults
|
||||
database: test_site
|
||||
database: orbit_site_new
|
||||
@@ -207,16 +207,6 @@ Orbit::Application.routes.draw do
|
||||
get 'preference'
|
||||
end
|
||||
|
||||
get "import_data/get_teacher_data"
|
||||
get "import_data/get_book_data"
|
||||
get "import_data/get_conference_data"
|
||||
get "import_data/get_journal_paper_data"
|
||||
get "import_data/get_announcement_data"
|
||||
get "import_data/get_page_data"
|
||||
get "import_data/sync_book_data"
|
||||
get "import_data/sync_journal_paper_data"
|
||||
get "import_data/sync_conference_data"
|
||||
|
||||
resources :tags do
|
||||
collection do
|
||||
post 'add_to_default'
|
||||
|
||||
@@ -12,9 +12,9 @@ module DefaultWidgetTagHelper
|
||||
if param.is_a?(Array) and !param.blank?
|
||||
params_str << param.collect{|t| "#{index}[]=#{t}"}.join("&")
|
||||
params.delete index
|
||||
params_str = params_str + "&"
|
||||
end
|
||||
end
|
||||
|
||||
params_str = params_str + (params_str.eql?("?") ? params.to_param : "&#{params.to_param}" )
|
||||
content_tag :div,:class=> 'more' do
|
||||
link_to I18n.t(@more_link[:label_i18n]),[eval("#{@more_link[:path_method]}"),params_str].join()
|
||||
|
||||
@@ -24,7 +24,6 @@ module ParserFrontEnd
|
||||
# tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
|
||||
# category = params[:category_id].blank? ? page[:category] : params[:category_id]
|
||||
body = Nokogiri::HTML(page.content)
|
||||
|
||||
if @edit
|
||||
body.css('.page_part').each do |page_part|
|
||||
part = PagePart.find(page_part['part_id']) rescue nil
|
||||
@@ -41,13 +40,16 @@ module ParserFrontEnd
|
||||
end
|
||||
|
||||
body.css('orbit_front').each do |front|
|
||||
|
||||
if front['value']
|
||||
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div id='#{front['id']}' class='#{front['class']}'>#{eval(front['value']).to_s}</div>")
|
||||
else
|
||||
ret = ''
|
||||
part = PagePart.find(front['part_id']) if front['part_id']
|
||||
ret << eval("\"#{front['path']}\"") rescue ''
|
||||
ret << (ret.include?("?") ? "&#{args.to_param}" : "?#{args.to_param}") if args.present?
|
||||
ar = args.to_param
|
||||
ar = URI.unescape(ar)
|
||||
ret << (ret.include?("?") ? "&#{ar}" : "?#{ar}") if args.present?
|
||||
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>")
|
||||
end
|
||||
front.swap(fragment)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace :gallery do
|
||||
task :migrate_albums => :environment do
|
||||
@albums = GalleryAlbum.all
|
||||
@albums.each do |album|
|
||||
newalbum = Album.new
|
||||
newalbum.name = album.name
|
||||
newalbum.description = album.description
|
||||
newalbum.cover = album.cover
|
||||
newalbum.cover_path = album.cover_path
|
||||
newalbum.tag_names = album.tag_names
|
||||
newalbum.category_id = album.category_id
|
||||
newalbum.save!
|
||||
@images = album.gallery_images
|
||||
@images.each do |image|
|
||||
img = newalbum.album_images.new
|
||||
img.title = image.title
|
||||
img.description = image.description
|
||||
img.file = image.file
|
||||
img.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -122,7 +122,7 @@ namespace :migrate do
|
||||
a.widgets = {}
|
||||
a.widgets[:widget1] = []
|
||||
a.widget_options_fields_i18n = {"widget1"=>{"vertical"=>"gallery.widget_option.vertical", "horizontal"=>"gallery.widget_option.horizontal", "album_id"=>"gallery.album"}}
|
||||
a.widget_options = {"widget1"=>{"vertical"=>[1, 2], "horizontal"=>[1, 2, 3, 4, 5, 6], "album_id"=>{"query"=>"GalleryAlbum.all", "value"=>:id, "label"=>:name}}}
|
||||
a.widget_options = {"widget1"=>{"vertical"=>[1, 2], "horizontal"=>[1, 2, 3, 4, 5, 6], "album_id"=>{"query"=>"Album.all", "value"=>:id, "label"=>:name}}}
|
||||
a.save
|
||||
end
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace :new_ui do
|
||||
%w(ask ask_question ask_category),
|
||||
%w(asset asset),
|
||||
%w(faq qa),
|
||||
%w(gallery gallery_album gallery_category),
|
||||
%w(gallery album gallery_category),
|
||||
%w(location location),
|
||||
%w(personal_book writing_book),
|
||||
%w(personal_conference writing_conference),
|
||||
|
||||
@@ -228,8 +228,8 @@ var galleryAPI = function(){
|
||||
next = imagecount + 1;
|
||||
prev = imagecount - 1;
|
||||
}
|
||||
$(".navN").attr({"href":imageArray[next]._id,"data-content":imageArray[next].file.url});
|
||||
$(".navP").attr({"href":imageArray[prev]._id,"data-content":imageArray[prev].file.url});
|
||||
$(".navN").attr({"href":imageArray[next]._id,"data-content":imageArray[next].file.theater.url});
|
||||
$(".navP").attr({"href":imageArray[prev]._id,"data-content":imageArray[prev].file.theater.url});
|
||||
};
|
||||
if(imageArray.length > 1)
|
||||
updateNavigation();
|
||||
|
||||
+5
-7
@@ -19,7 +19,7 @@ var galleryAPI = function(){
|
||||
if(photo_id){
|
||||
var params = rcom.getUrlVars();
|
||||
var url = window.location.href.split("?")[0];
|
||||
params["id"] = photo_id;
|
||||
params["image_id"] = photo_id;
|
||||
for(i=0;i<params.length;i++){
|
||||
if(i == 0)
|
||||
url+="?"+params[i]+"="+params[params[i]];
|
||||
@@ -34,7 +34,7 @@ var galleryAPI = function(){
|
||||
|
||||
}
|
||||
|
||||
this.loadTheater = function(id){
|
||||
this.loadTheater = function(albumid,id){
|
||||
var imageArray;
|
||||
var imagecount = 0;
|
||||
// var picHeight = 0;
|
||||
@@ -163,7 +163,6 @@ var galleryAPI = function(){
|
||||
});
|
||||
}else{
|
||||
$img.attr({"src":dom.attr("data-content")}).css("height","auto").load(function(){
|
||||
console.log(dom.attr("data-content"));
|
||||
g.loadcomplete();
|
||||
$img.fadeIn(200);
|
||||
});;
|
||||
@@ -174,9 +173,8 @@ var galleryAPI = function(){
|
||||
$slidelist.stop().animate({'height':'0px'}, 300);
|
||||
$slidelist.find("ul").hide();
|
||||
if(rcom.getInternetExplorerVersion() == -1){
|
||||
|
||||
if(pageurl!=window.location){
|
||||
pageurl = window.location.pathname+"?id="+pageurl+"&controller_action=theater";
|
||||
pageurl = window.location.pathname+"?id="+albumid+"&controller_action=theater&image_id="+pageurl;
|
||||
window.history.pushState({path:pageurl},'',pageurl);
|
||||
}
|
||||
}else{
|
||||
@@ -205,8 +203,8 @@ var galleryAPI = function(){
|
||||
next = imagecount + 1;
|
||||
prev = imagecount - 1;
|
||||
}
|
||||
$(".navN").attr({"href":imageArray[next]._id,"data-content":imageArray[next].file.url});
|
||||
$(".navP").attr({"href":imageArray[prev]._id,"data-content":imageArray[prev].file.url});
|
||||
$(".navN").attr({"href":imageArray[next]._id,"data-content":imageArray[next].file.theater.url});
|
||||
$(".navP").attr({"href":imageArray[prev]._id,"data-content":imageArray[prev].file.theater.url});
|
||||
};
|
||||
if(imageArray.length > 1)
|
||||
updateNavigation();
|
||||
|
||||
Vendored
+15
-15
@@ -6,32 +6,32 @@ class Panel::Gallery::BackEnd::AlbumImagesController < OrbitBackendController
|
||||
|
||||
def show
|
||||
@tags = get_tags
|
||||
@image = GalleryImage.find(params[:id])
|
||||
@albumid = @image.gallery_album_id
|
||||
@album = GalleryAlbum.find(@albumid)
|
||||
@images = @album.gallery_images.all
|
||||
@image = AlbumImage.find(params[:id])
|
||||
@albumid = @image.album_id
|
||||
@album = Album.find(@albumid)
|
||||
@images = @album.album_images.all
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
images = params['images']
|
||||
images.each do |image|
|
||||
img = GalleryImage.find(image)
|
||||
img = AlbumImage.find(image)
|
||||
img.delete
|
||||
end
|
||||
if params['delete_cover'] == "true"
|
||||
album = GalleryAlbum.find(params['id'])
|
||||
album = Album.find(params['id'])
|
||||
album.update_attributes(:cover=>"default",:cover_path => nil)
|
||||
end
|
||||
render :json =>{"success"=>true}.to_json
|
||||
end
|
||||
|
||||
def update_image
|
||||
image = GalleryImage.find(params[:image_id])
|
||||
image.update_attributes(params[:gallery_image])
|
||||
image = AlbumImage.find(params[:image_id])
|
||||
image.update_attributes(params[:album_image])
|
||||
image.save
|
||||
@album = GalleryAlbum.find(image.gallery_album_id.to_s)
|
||||
@images = @album.gallery_images
|
||||
@album = Album.find(image.album_id.to_s)
|
||||
@images = @album.album_images
|
||||
@image_content = []
|
||||
@images.each do |image|
|
||||
@image_content << {"id" => image.id.to_s, "description" => image.description_translations,"tags" => image.tagged_ids}
|
||||
@@ -42,11 +42,11 @@ class Panel::Gallery::BackEnd::AlbumImagesController < OrbitBackendController
|
||||
def delete_photos
|
||||
images = params['images']
|
||||
images.each do |image|
|
||||
img = GalleryImage.find(image)
|
||||
img = AlbumImage.find(image)
|
||||
img.delete
|
||||
end
|
||||
if params['delete_cover'] == "true"
|
||||
album = GalleryAlbum.find(params['album_id'])
|
||||
album = Album.find(params['album_id'])
|
||||
album.update_attributes(:cover=>"default",:cover_path => nil)
|
||||
end
|
||||
render :json =>{"success"=>true}.to_json
|
||||
@@ -57,13 +57,13 @@ class Panel::Gallery::BackEnd::AlbumImagesController < OrbitBackendController
|
||||
tags = params[:tag_ids]
|
||||
i = nil
|
||||
images.each do |image|
|
||||
img = GalleryImage.find(image)
|
||||
img = AlbumImage.find(image)
|
||||
img.tagged_ids = tags
|
||||
img.save
|
||||
i = img
|
||||
end
|
||||
@album = GalleryAlbum.find(i.gallery_album_id.to_s)
|
||||
@images = @album.gallery_images
|
||||
@album = Album.find(i.album_id.to_s)
|
||||
@images = @album.album_images
|
||||
@image_content = []
|
||||
@images.each do |image|
|
||||
@image_content << {"id" => image.id.to_s, "description" => image.description_translations,"tags" => image.tagged_ids}
|
||||
|
||||
Vendored
+31
-30
@@ -13,12 +13,13 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||
@categories = get_categories_for_index
|
||||
@tags = get_tags
|
||||
category_ids = @categories.collect{|t| t.id}
|
||||
@albums = get_sorted_and_filtered("gallery_album", :category_id.in => category_ids)
|
||||
@albums = get_sorted_and_filtered("album", :category_id.in => category_ids)
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
@album = GalleryAlbum.find(params[:id])
|
||||
@images = @album.gallery_images
|
||||
@album = Album.find(params[:id])
|
||||
@images = @album.album_images
|
||||
@image_content = []
|
||||
@images.each do |image|
|
||||
@image_content << {"id" => image.id.to_s, "description" => image.description_translations,"tags" => image.tagged_ids}
|
||||
@@ -33,12 +34,12 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||
def new
|
||||
@categories = get_categories_for_index
|
||||
@tags = get_tags
|
||||
@album = GalleryAlbum.new
|
||||
@album = Album.new
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
album = GalleryAlbum.new(params[:gallery_album])
|
||||
album = Album.new(params[:album])
|
||||
album.save!
|
||||
redirect_to panel_gallery_back_end_albums_path
|
||||
end
|
||||
@@ -46,31 +47,31 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||
|
||||
|
||||
def destroy
|
||||
album = GalleryAlbum.find(params[:id])
|
||||
album = Album.find(params[:id])
|
||||
album.destroy
|
||||
redirect_to panel_gallery_back_end_albums_path
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
@album = GalleryAlbum.find(params[:id])
|
||||
@album = Album.find(params[:id])
|
||||
@tags = get_tags
|
||||
end
|
||||
|
||||
def set_cover
|
||||
if params[:set_cover] == "true"
|
||||
album = GalleryAlbum.find(params[:album_id])
|
||||
image = GalleryImage.find(params[:image_id])
|
||||
album = Album.find(params[:album_id])
|
||||
image = AlbumImage.find(params[:image_id])
|
||||
album.update_attributes({:cover_path => image.file.thumb.url, :cover=>params[:image_id]})
|
||||
else
|
||||
album = GalleryAlbum.find(params[:album_id])
|
||||
album = Album.find(params[:album_id])
|
||||
album.update_attributes({:cover_path => nil, :cover=>"default"})
|
||||
end
|
||||
render :json =>{"success"=>true}.to_json
|
||||
end
|
||||
|
||||
def get_album_json
|
||||
albums = GalleryAlbum.all
|
||||
albums = Album.all
|
||||
output = Array.new
|
||||
|
||||
albums.each do |album|
|
||||
@@ -96,8 +97,8 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||
end
|
||||
|
||||
def get_imgs_json
|
||||
album = GalleryAlbum.find(params[:album_id])
|
||||
images = album.gallery_images.all
|
||||
album = Album.find(params[:album_id])
|
||||
images = album.album_images.all
|
||||
output = Array.new
|
||||
|
||||
images.each do |image|
|
||||
@@ -119,9 +120,9 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||
end
|
||||
|
||||
def imgs
|
||||
@album = GalleryAlbum.find(params[:album_id])
|
||||
@album = Album.find(params[:album_id])
|
||||
@tag_names = Array.new
|
||||
@images = @album.gallery_images.all
|
||||
@images = @album.album_images.all
|
||||
@output = Array.new
|
||||
@images.each do |values|
|
||||
tags = Array.new
|
||||
@@ -133,7 +134,7 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||
description: values.description,
|
||||
title: values.title,
|
||||
file: values.file.as_json[:file],
|
||||
gallery_album_id: values.gallery_album_id,
|
||||
gallery_album_id: values.album_id,
|
||||
tag_ids: values.tag_ids,
|
||||
tag_names: tags}
|
||||
end
|
||||
@@ -143,11 +144,11 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||
|
||||
|
||||
def upload_image
|
||||
@album = GalleryAlbum.find(params[:album_id])
|
||||
@album = Album.find(params[:album_id])
|
||||
@files = params['files']
|
||||
a = Array.new
|
||||
@files.each do |file|
|
||||
@image = @album.gallery_images.new
|
||||
@image = @album.album_images.new
|
||||
@image.file = file
|
||||
@image.save!
|
||||
a << {"thumbnail_url"=>@image.file.thumb.url,"url"=>panel_gallery_back_end_album_image_path(@image)}
|
||||
@@ -157,21 +158,21 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||
|
||||
def new_images
|
||||
if params[:last_image_id] != ""
|
||||
@lastimage = GalleryImage.find(params[:last_image_id])
|
||||
@album = GalleryAlbum.find(params[:album_id])
|
||||
@newimages = @album.gallery_images.where(:created_at.gt => @lastimage.created_at)
|
||||
@lastimage = AlbumImage.find(params[:last_image_id])
|
||||
@album = Album.find(params[:album_id])
|
||||
@newimages = @album.album_images.where(:created_at.gt => @lastimage.created_at)
|
||||
else
|
||||
@album = GalleryAlbum.find(params[:album_id])
|
||||
@newimages = @album.gallery_images
|
||||
@album = Album.find(params[:album_id])
|
||||
@newimages = @album.album_images
|
||||
end
|
||||
render :layout=>false
|
||||
end
|
||||
|
||||
|
||||
def images_tags
|
||||
album = GalleryAlbum.find(params[:album_id])
|
||||
album = Album.find(params[:album_id])
|
||||
tags = Array.new
|
||||
images = album.gallery_images.all
|
||||
images = album.album_images.all
|
||||
images.each do |image|
|
||||
tags << {"id"=>image.id, "tags" => image.tag_ids}
|
||||
end
|
||||
@@ -179,10 +180,10 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||
end
|
||||
|
||||
def update
|
||||
@album = GalleryAlbum.find(params[:id])
|
||||
@album = Album.find(params[:id])
|
||||
tagsToDestroy = []
|
||||
tagsToAdd = []
|
||||
new_tags = params[:gallery_album][:tag_ids]
|
||||
new_tags = params[:album][:tag_ids]
|
||||
old_tags = @album.tagged_ids
|
||||
old_tags.each do |tag|
|
||||
if !new_tags.include?(tag)
|
||||
@@ -197,14 +198,14 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||
end
|
||||
end
|
||||
update_children_image_tag(tagsToDestroy,tagsToAdd)
|
||||
@album.update_attributes(params[:gallery_album])
|
||||
@album.update_attributes(params[:album])
|
||||
redirect_to panel_gallery_back_end_album_path(@album)
|
||||
end
|
||||
|
||||
def update_children_image_tag(tagsToDestroy,tagsToAdd)
|
||||
# tagsToDestroy will contain all tag ids which have to be deleted from the galley_images
|
||||
# tagsToAdd will contain all tag ids which ve to be added in tall gallery_images
|
||||
@images = GalleryImage.all
|
||||
# tagsToAdd will contain all tag ids which ve to be added in tall album_images
|
||||
@images = AlbumImage.all
|
||||
@images.each do |image|
|
||||
image.tagged_ids.concat(tagsToAdd)
|
||||
tagsToDestroy.each do |tag|
|
||||
|
||||
Vendored
+12
-12
@@ -1,16 +1,16 @@
|
||||
class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
|
||||
def index
|
||||
@albums = GalleryAlbum.where(:category_id.in => params[:category_id])
|
||||
@albums = Album.where(:category_id.in => params[:category_id])
|
||||
end
|
||||
|
||||
def show
|
||||
@album = GalleryAlbum.find(params[:id])
|
||||
@images = @album.gallery_images
|
||||
@album = Album.find(params[:id])
|
||||
@images = @album.album_images
|
||||
end
|
||||
|
||||
def imgs
|
||||
@album = GalleryAlbum.find(params[:id])
|
||||
@images = @album.gallery_images.all
|
||||
@album = Album.find(params[:id])
|
||||
@images = @album.album_images.all
|
||||
@output = Array.new
|
||||
@images.each do |values|
|
||||
tags = Tag.find(values.tagged_ids).map{|t| t.name}
|
||||
@@ -19,7 +19,7 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
|
||||
:description => values.description,
|
||||
:title => values.title,
|
||||
:file => values.file.as_json[:file],
|
||||
:gallery_album_id => values.gallery_album_id,
|
||||
:gallery_album_id => values.album_id,
|
||||
:tag_ids => values.tag_ids,
|
||||
:tag_names => tags}
|
||||
end
|
||||
@@ -27,9 +27,9 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
|
||||
end
|
||||
|
||||
def images_tags
|
||||
album = GalleryAlbum.find(params[:album_id])
|
||||
album = Album.find(params[:album_id])
|
||||
tags = Array.new
|
||||
images = album.gallery_images.all
|
||||
images = album.album_images.all
|
||||
images.each do |image|
|
||||
tags << {"id"=>image.id, "tags" => image.tag_ids}
|
||||
end
|
||||
@@ -37,10 +37,10 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
|
||||
end
|
||||
|
||||
def theater
|
||||
@image = GalleryImage.find(params[:id])
|
||||
@albumid = @image.gallery_album_id
|
||||
@album = GalleryAlbum.find(@albumid)
|
||||
@images = @album.gallery_images.all
|
||||
@image = AlbumImage.find(params[:image_id])
|
||||
@albumid = @image.album_id
|
||||
@album = Album.find(@albumid)
|
||||
@images = @album.album_images.all
|
||||
tags = @album.tagged_ids
|
||||
@tagnames = Tag.find(tags).map{|t| t.name}
|
||||
@back_link = panel_gallery_front_end_album_path(@albumid)
|
||||
|
||||
+26
-19
@@ -6,8 +6,8 @@ class Panel::Gallery::Widget::AlbumsController < OrbitWidgetController
|
||||
vertical = @part.widget_options['vertical'].to_i rescue 0
|
||||
horizontal = @part.widget_options['horizontal'].to_i rescue 0
|
||||
|
||||
@album = GalleryAlbum.find(@part.widget_options['album_id']) rescue nil
|
||||
@album_images = @album.gallery_images if @album
|
||||
@album = Album.find(@part.widget_options['album_id']) rescue nil
|
||||
@album_images = @album.album_images if @album
|
||||
|
||||
|
||||
@settings = {"vertical"=>vertical,"horizontal"=>horizontal} #[note] horizontal has it's limitation from 2 to 6
|
||||
@@ -16,27 +16,34 @@ class Panel::Gallery::Widget::AlbumsController < OrbitWidgetController
|
||||
@rnd = Random.new
|
||||
@images = []
|
||||
|
||||
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}
|
||||
if !@album_images.nil?
|
||||
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(@album,:image_id=>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(@album,:image_id=>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(@album,:image_id=>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
|
||||
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
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
class GalleryAlbum
|
||||
class Album
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
@@ -12,7 +12,7 @@ class GalleryAlbum
|
||||
field :tag_names
|
||||
|
||||
# has_and_belongs_to_many :tags, :class_name => "GalleryTag"
|
||||
has_many :gallery_images, :autosave => true, :dependent => :destroy
|
||||
accepts_nested_attributes_for :gallery_images, :allow_destroy => true
|
||||
has_many :album_images, :autosave => true, :dependent => :destroy
|
||||
accepts_nested_attributes_for :album_images, :allow_destroy => true
|
||||
|
||||
end
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
class GalleryImage
|
||||
class AlbumImage
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitTag::Taggable
|
||||
@@ -10,6 +10,6 @@ class GalleryImage
|
||||
|
||||
# has_and_belongs_to_many :tags, :class_name => "GalleryTag"
|
||||
|
||||
belongs_to :gallery_album
|
||||
belongs_to :album
|
||||
|
||||
end
|
||||
@@ -9,7 +9,7 @@ class GalleryCategory
|
||||
|
||||
field :name, localize: true
|
||||
|
||||
has_many :gallery_albums, :autosave => true, :dependent => :destroy
|
||||
has_many :albums, :autosave => true, :dependent => :destroy
|
||||
|
||||
def title
|
||||
name
|
||||
|
||||
@@ -53,6 +53,10 @@ class GalleryUploader < CarrierWave::Uploader::Base
|
||||
process :resize_to_fill => [200, 200]
|
||||
end
|
||||
|
||||
version :theater do
|
||||
process :resize_to_limit => [1920, 1080]
|
||||
end
|
||||
|
||||
# Add a white list of extensions which are allowed to be uploaded.
|
||||
# For images you might use something like this:
|
||||
# def extension_white_list
|
||||
|
||||
Vendored
+2
-30
@@ -6,7 +6,7 @@
|
||||
<div id="imgholder">
|
||||
<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="comp" id='main_pic' data-content='<%= @image.album_id %>'><a href="" id="nextpic" class="navN" title="下一張" onclick="return false;" ><img src="<%= @image.file.theater.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>
|
||||
@@ -15,7 +15,7 @@
|
||||
<div class="slidelist">
|
||||
<ul id='galleryimagelist' style="display:none;">
|
||||
<% @images.each_with_index do |image,i| %>
|
||||
<li for="<%= i %>"><a href="<%= image.id %>" class="list_element" data-content="<%= image.file.url %>" onclick="return false;"><img src="<%= image.file.thumb.url %>" alt="" onload="gallery.loadcomplete();" /></a></li>
|
||||
<li for="<%= i %>"><a href="<%= image.id %>" class="list_element" data-content="<%= image.file.theater.url %>" onclick="return false;"><img src="<%= image.file.thumb.url %>" alt="" onload="gallery.loadcomplete();" /></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -30,34 +30,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if is_admin? %>
|
||||
<!-- #TODO or 類別屬於他 -->
|
||||
<!-- tag part -->
|
||||
<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
|
||||
%>
|
||||
|
||||
<%# if @authenticated %>
|
||||
<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>
|
||||
<%# end %>
|
||||
|
||||
</div>
|
||||
|
||||
<%end%>
|
||||
|
||||
<!-- tag end -->
|
||||
<div class="form-actions form-fixed pagination-right rghead">
|
||||
<div class="rgfn">
|
||||
<%= link_to (content_tag(:i,I18n.t("gallery.back_to_photos"),:class=>"icon-arrow-left icon-black")),"",:class=>"bt-back btn pull-left btn-primary",:title=>I18n.t("gallery.back_to_photos")%>
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<%@tags.each do |tag|%>
|
||||
<label class="checkbox inline btn <%= 'active' if @album.tag_ids.include?(tag.id) %>">
|
||||
<%= check_box_tag 'gallery_album[tag_ids][]', tag.id, @album.tag_ids.include?(tag.id)%>
|
||||
<%= check_box_tag 'album[tag_ids][]', tag.id, @album.tag_ids.include?(tag.id)%>
|
||||
<%= tag.name %>
|
||||
</label>
|
||||
<%end %>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<div class='rgphoto'>
|
||||
<a title='<%= image.description %>' href='<%= theater_panel_gallery_front_end_album_path(image) %>'>
|
||||
<a title='<%= image.description %>' href='<%= theater_panel_gallery_front_end_album_path(@album,:image_id=>image) %>'>
|
||||
<img src='<%= image.file.thumb.url %>'/>
|
||||
</a>
|
||||
</div>
|
||||
+3
-3
@@ -6,7 +6,7 @@
|
||||
<div id="imgholder">
|
||||
<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="comp" id='main_pic' data-content='<%= @image.album_id %>'><a href="" id="nextpic" class="navN" title="下一張" onclick="return false;" ><img src="<%= @image.file.theater.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>
|
||||
@@ -15,7 +15,7 @@
|
||||
<div class="slidelist">
|
||||
<ul id='galleryimagelist' style="display:none;">
|
||||
<% @images.each_with_index do |image,i| %>
|
||||
<li for="<%= i %>"><a href="<%= image.id %>" class="list_element" data-content="<%= image.file.url %>" onclick="return false;"><img src="<%= image.file.thumb.url %>" alt="" /></a></li>
|
||||
<li for="<%= i %>"><a href="<%= image.id %>" class="list_element" data-content="<%= image.file.theater.url %>" onclick="return false;"><img src="<%= image.file.thumb.url %>" alt="" /></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -58,7 +58,7 @@
|
||||
var gallery = new galleryAPI();
|
||||
gallery.initialize();
|
||||
gallery.loadArea = "theater";
|
||||
gallery.loadTheater("<%= params[:id] %>");
|
||||
gallery.loadTheater("<%= params[:id] %>","<%= params[:image_id] %>");
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
<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 class="inputui rginput rgih26 w380"><input type="text" name="album[name_translations][<%= locale %>]" value="<%= @album_name[locale] %>" class="txtchange" /></div>
|
||||
</div>
|
||||
|
||||
<div class='description_loader'>
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@
|
||||
</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="comp" id='main_pic' data-content='<%= @image.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>
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ module Gallery
|
||||
# image :image
|
||||
# end
|
||||
|
||||
categories_query 'GalleryCategory.all'
|
||||
# categories_query 'GalleryCategory.all'
|
||||
# tags_query 'GalleryTag.all'
|
||||
|
||||
#* customize_widget "albums","gallery.widget.albums",:fields=>[],:style=>[],:options=>{"widget1"=>{"vertical"=>[1, 2], "horizontal"=>[1, 2, 3, 4, 5, 6], "album_id"=>{"query"=>"GalleryAlbum.all", "value"=>:id, "label"=>:name}}}
|
||||
@@ -37,7 +37,7 @@ module Gallery
|
||||
style ["1","2"]
|
||||
options "vertical",:i18n => "gallery.widget_option.vertical",:options_item=>[1, 2]
|
||||
options "horizontal",:i18n => "gallery.widget_option.horizontal",:options_item=>[1, 2,3,4,5,6]
|
||||
options "album_id",:i18n =>"gallery.album",:options_item => {"query"=>"GalleryAlbum.all", "value"=>:id, "label"=>:name}
|
||||
options "album_id",:i18n =>"gallery.album",:options_item => {"query"=>"Album.all", "value"=>:id, "label"=>:name}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
vendor/built_in_modules/personal_book/app/assets/javascripts/personal_book/desktop/personal_books.js
Vendored
-5
@@ -92,11 +92,6 @@ orbitDesktop.prototype.initializePersonalBook = function(target,url,cache){ // t
|
||||
width: $(".overview").width() - 20
|
||||
});
|
||||
}
|
||||
|
||||
this.initializePersonalBook.syncComplete = function(){
|
||||
o.notify("Sync Complete","success");
|
||||
o.sub_menu_item($("div[content-type=menu] a").eq(0));
|
||||
}
|
||||
|
||||
this.initializePersonalBook.coAuthorformCallback = function(data){
|
||||
if(data.success){
|
||||
|
||||
-1
@@ -8,7 +8,6 @@ class Panel::PersonalBook::Desktop::PersonalBooksController < ApplicationControl
|
||||
|
||||
@per_column = 5
|
||||
|
||||
@userid = current_user.id
|
||||
case @view_by
|
||||
when "abstract"
|
||||
@per_column = 1
|
||||
|
||||
@@ -90,7 +90,7 @@ class WritingBook
|
||||
title << self.publisher if self.publisher.present?
|
||||
title << self.pages if self.pages.present?
|
||||
# title << "(#{self.journal_level_types.collect{|x| x.title}.join(', ')})"
|
||||
title.join(', ')
|
||||
title.join(', ')
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
-5
@@ -57,11 +57,6 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hh1 hp sdm">
|
||||
<div class="sdm_t hh1"><a href="<%= admin_import_data_sync_book_data_path(:user_id=>@userid) %>" class="icons-cycle" ajax-remote="get" response-type="json" callback-method="syncComplete" > Sync Books</a></div>
|
||||
</div>
|
||||
|
||||
<div class="hh1 hp sdm">
|
||||
<div class="sdm_t hh1"><span class="icon-question-sign"></span></div>
|
||||
</div>
|
||||
|
||||
Vendored
-2
@@ -75,8 +75,6 @@
|
||||
<% if is_admin? %>
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.sync_data'),admin_import_data_sync_book_data_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_book_back_end_personal_book_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_book_back_end_writing_book_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
|
||||
-4
@@ -42,10 +42,6 @@ orbitDesktop.prototype.initializeConferencePapers = function(target,url,cache){
|
||||
this.initializeConferencePapers.cancelpaper = function(){
|
||||
o.highlight_sub_menu_item(0);
|
||||
}
|
||||
this.initializeConferencePapers.syncComplete = function(){
|
||||
o.notify("Sync Complete","success");
|
||||
o.sub_menu_item($("div[content-type=menu] a").eq(0));
|
||||
}
|
||||
|
||||
var uploadFiles = function(){
|
||||
$('#add_plugin_file a.add').click(function(){
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ class Panel::PersonalConference::Desktop::ConferencePagesController < Applicatio
|
||||
@writing_conferences = WritingConference.where(create_user_id: current_user.id)
|
||||
page = params[:page]
|
||||
page ||= 1
|
||||
@userid = current_user.id
|
||||
|
||||
if @view_by.nil?
|
||||
@writing_conferences = @writing_conferences.asc(:paper_title)
|
||||
else
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ class WritingConference
|
||||
title << self.location if self.location.present?
|
||||
title << "#{period_start_date}-#{period_end_date}" if (self.period_start_date.present? && self.period_end_date.present?)
|
||||
# title << "(#{self.conference_paper_types.collect{|x| x.title}.join(', ')})"
|
||||
title.join(', ')
|
||||
title.join(', ')
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
-5
@@ -58,12 +58,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hh1 hp sdm">
|
||||
<div class="sdm_t hh1"><a href="<%= admin_import_data_sync_conference_data_path(:user_id => @userid) %>" class="icons-cycle" ajax-remote="get" response-type="json" callback-method="syncComplete" > Sync Conference Papers</a></div>
|
||||
</div>
|
||||
|
||||
<div class="hh1 hp sdm">
|
||||
<div class="sdm_t hh1"><span class="icon-question-sign"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
-4
@@ -75,11 +75,7 @@
|
||||
<% if is_admin? %>
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.sync_data'), admin_import_data_sync_conference_data_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_conference_back_end_personal_conference_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_conference_back_end_writing_conference_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
<div class="pagination pagination-centered">
|
||||
|
||||
-4
@@ -42,10 +42,6 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
|
||||
this.initializeJournalPapers.cancelpaper = function(){
|
||||
o.highlight_sub_menu_item(0);
|
||||
}
|
||||
this.initializeJournalPapers.syncComplete = function(){
|
||||
o.notify("Sync Complete","success");
|
||||
o.sub_menu_item($("div[content-type=menu] a").eq(0));
|
||||
}
|
||||
|
||||
var uploadFiles = function(){
|
||||
$('#add_plugin_file a.add').click(function(){
|
||||
|
||||
+1
-2
@@ -7,8 +7,7 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr
|
||||
page ||= 1
|
||||
|
||||
@per_column = 5
|
||||
|
||||
@userid = current_user.id
|
||||
|
||||
case @view_by
|
||||
when "abstract"
|
||||
@per_column = 1
|
||||
|
||||
@@ -96,7 +96,7 @@ class WritingJournal
|
||||
title << "Volume No: "+self.vol_no if (self.vol_no.present? && self.vol_no != "0")
|
||||
title << "From Page: "+self.form_to_start if (self.form_to_start.present? && self.form_to_start != "0")
|
||||
title << "To Page: "+self.form_to_end if (self.form_to_end.present? && self.form_to_end != "0")
|
||||
title.join(', ')
|
||||
title.join(', ')
|
||||
end
|
||||
|
||||
def new_writing_journal_files=(var)
|
||||
|
||||
-4
@@ -58,10 +58,6 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hh1 hp sdm">
|
||||
<div class="sdm_t hh1"><a href="<%= admin_import_data_sync_journal_paper_data_path(:user_id => @userid) %>" class="icons-cycle" ajax-remote="get" response-type="json" callback-method="syncComplete" > Sync Books</a></div>
|
||||
</div>
|
||||
|
||||
<div class="hh1 hp sdm">
|
||||
<div class="sdm_t hh1"><span class="icon-question-sign"></span></div>
|
||||
</div>
|
||||
|
||||
Vendored
-2
@@ -80,8 +80,6 @@
|
||||
<% if is_admin? %>
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.sync_data'), admin_import_data_sync_journal_paper_data_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_journal_back_end_personal_journal_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_journal_back_end_writing_journal_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
|
||||
+2
-2
@@ -23,8 +23,8 @@ class Panel::WebResource::FrontEnd::WebLinksController < OrbitWidgetController
|
||||
date_now = Time.now
|
||||
|
||||
# @web_link_categorys = get_categories_for_index
|
||||
if !params[:category_id].blank?
|
||||
@web_link_categorys = @module_app.categories.enabled.any_in(:_id => params[:category_id])
|
||||
if !params[:filter_category_id].blank?
|
||||
@web_link_categorys = @module_app.categories.enabled.any_in(:_id => params[:filter_category_id])
|
||||
else
|
||||
@web_link_categorys = @module_app.categories.enabled
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user