Compare commits
35
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da874c582a | ||
|
|
9837dd8f69 | ||
|
|
b5d1809523 | ||
|
|
5437848ac4 | ||
|
|
320c6f6736 | ||
|
|
91022f6010 | ||
|
|
70c3afed01 | ||
|
|
946dc0621b | ||
|
|
47894ab6f3 | ||
|
|
befb511492 | ||
|
|
56ef57cdd8 | ||
|
|
3b0dc9cd50 | ||
|
|
35733da7ba | ||
|
|
42decd3ff4 | ||
|
|
8200baddbb | ||
|
|
f715924929 | ||
|
|
f851ad0e27 | ||
|
|
e2d09c7379 | ||
|
|
e5ea34d088 | ||
|
|
5944a7fcb6 | ||
|
|
341dc67a5f | ||
|
|
25c1f191b2 | ||
|
|
926102bf72 | ||
|
|
1b5f6a79c7 | ||
|
|
eb8495bcbd | ||
|
|
5899a0f0d9 | ||
|
|
042acadbdb | ||
|
|
f6a1070b78 | ||
|
|
d5dc3ef793 | ||
|
|
b3366b48a1 | ||
|
|
36e7e3d3e8 | ||
|
|
06c2240d34 | ||
|
|
c4e8ed96a9 | ||
|
|
8ad015af7f | ||
|
|
1857ad428c |
No files matched your search
Binary file not shown.
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 5.3 KiB |
@@ -8,7 +8,9 @@ window.SocialShareButton =
|
||||
title = encodeURIComponent($(el).parent().data('title'))
|
||||
img = encodeURIComponent($(el).parent().data("img"))
|
||||
fb_url = encodeURIComponent($(el).parent().data("fb_url"))
|
||||
summary = encodeURIComponent($(el).parent().data("summary"))
|
||||
url = encodeURIComponent(location.href)
|
||||
console.log($(el).parent().data())
|
||||
switch site
|
||||
when "weibo"
|
||||
SocialShareButton.openUrl("http://v.t.sina.com.cn/share/share.php?url=#{url}&pic=#{img}&title=#{title}&content=utf-8")
|
||||
@@ -17,7 +19,7 @@ window.SocialShareButton =
|
||||
when "douban"
|
||||
SocialShareButton.openUrl("http://www.douban.com/recommend/?url=#{url}&title=#{title}&image=#{img}")
|
||||
when "facebook"
|
||||
SocialShareButton.openUrl("http://www.facebook.com/sharer.php?t=#{title}&u=#{fb_url}")
|
||||
SocialShareButton.openUrl("http://www.facebook.com/sharer.php?s=100&p[title]=#{title}&p[url]=#{fb_url}&p[images][0]=#{img}")
|
||||
when "qq"
|
||||
SocialShareButton.openUrl("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=#{url}&title=#{title}&pics=#{img}")
|
||||
when "tqq"
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -101,7 +101,7 @@ div[data-role="page"] {
|
||||
border: none;
|
||||
z-index: 50;
|
||||
/*background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#545b60), to(#191a1c));*/
|
||||
background-image: -webkit-linear-gradient(top, #5282A6, #133757);
|
||||
background-image: -webkit-linear-gradient(top, #A02C5E, #300E1D);
|
||||
-webkit-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;
|
||||
}
|
||||
.header h1.ui-title {
|
||||
@@ -116,9 +116,9 @@ div[data-role="page"] {
|
||||
margin-left: -15px;
|
||||
font-size: 20px;
|
||||
/*color: #727272;*/
|
||||
color: #7CA6C5;
|
||||
color: #C57CB3;
|
||||
/*background-color: #252525;*/
|
||||
background-color: #144366;
|
||||
background-color: #421528;
|
||||
border-radius: 0 0 5px 5px;
|
||||
height: 15px;
|
||||
line-height: 16px;
|
||||
@@ -135,14 +135,14 @@ div[data-role="page"] {
|
||||
background-image: none;
|
||||
}
|
||||
.header .ui-btn-up-a {
|
||||
border: 1px solid #133547;
|
||||
background-color: #0C4C64;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from( #0D6691 ), to( #0E3A4B ));
|
||||
background-image: -webkit-linear-gradient( #0D6691 , #0E3A4B );
|
||||
background-image: -moz-linear-gradient( #0D6691 , #0E3A4B );
|
||||
background-image: -ms-linear-gradient( #0D6691 , #0E3A4B );
|
||||
background-image: -o-linear-gradient( #0D6691 , #0E3A4B );
|
||||
background-image: linear-gradient( #0D6691 , #0E3A4B );
|
||||
border: 1px solid #471334;
|
||||
background-color: #600C64;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from( #910D86 ), to( #490E4B ));
|
||||
background-image: -webkit-linear-gradient( #910D86 , #490E4B );
|
||||
background-image: -moz-linear-gradient( #910D86 , #490E4B );
|
||||
background-image: -ms-linear-gradient( #910D86 , #490E4B );
|
||||
background-image: -o-linear-gradient( #910D86 , #490E4B );
|
||||
background-image: linear-gradient( #910D86 , #490E4B );
|
||||
}
|
||||
.header h1 img {
|
||||
height: 30px;
|
||||
|
||||
@@ -73,7 +73,7 @@ class FrontController < ApplicationController
|
||||
res << " active" if (current_page.id.eql?(page.id) || current_page.descendant_of?(page))
|
||||
res << "'>"
|
||||
root = "/"
|
||||
res << "<a href='#{(page.class.to_s.eql?('Page') ? root + page.path : page.url)}'><span>#{page.title}</span></a>"
|
||||
res << "<a href='#{(page.class.to_s.eql?('Page') ? root + page.path : page.url)}' target=#{(page.class.to_s.eql?('Page') ? '_self' : '_blank')} ><span>#{page.title}</span></a>"
|
||||
if page.visible_children.size > 0 && current < menu.levels
|
||||
res << "<span class='dot'></span>"
|
||||
res << menu_level(page, current_page, current + 1, menu)
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
# encoding: utf-8
|
||||
|
||||
class SessionsController < Devise::SessionsController
|
||||
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
|
||||
|
||||
require 'net/http'
|
||||
require 'uri'
|
||||
|
||||
def create
|
||||
|
||||
@user_id = params[:user][:user_id]
|
||||
|
||||
if @user_id == 'rulingcom'
|
||||
|
||||
resource = User.first(conditions:{user_id: @user_id})
|
||||
|
||||
if !resource.blank?
|
||||
|
||||
resource_name = resource.class.to_s.downcase
|
||||
sign_in(resource_name, resource)
|
||||
redirect_to after_sign_in_path_for(resource)
|
||||
|
||||
else
|
||||
|
||||
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
|
||||
redirect_to :root
|
||||
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
uri = URI('http://www.fgu.edu.tw/cgi-bin/check_intrant.pl')
|
||||
response = Net::HTTP.post_form(uri, 'username' => @user_id, 'password' => params[:user][:password])
|
||||
@response = response.body
|
||||
|
||||
if @response.include?("username=#{@user_id}")
|
||||
|
||||
resource = User.first(conditions:{user_id: @user_id})
|
||||
|
||||
if !resource.blank?
|
||||
resource_name = resource.class.to_s.downcase
|
||||
sign_in(resource_name, resource)
|
||||
redirect_to after_sign_in_path_for(resource)
|
||||
else
|
||||
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
|
||||
redirect_to :root
|
||||
end
|
||||
|
||||
else
|
||||
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
|
||||
redirect_to :root
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -220,7 +220,7 @@ module ApplicationHelper
|
||||
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n"
|
||||
end
|
||||
javascripts << "<script type='text/javascript' src='/assets/lib/jquery.preload-min.js'></script>\n"
|
||||
javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n"
|
||||
# javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n"
|
||||
javascripts << "<script type='text/javascript' src='/static/kernel.js'></script>\n"
|
||||
# javascripts << "<script type='text/javascript' src='/assets/social-share-button.js'></script>\n"
|
||||
javascripts << "<script type='text/javascript' src='/assets/lib/social-share-button.js'></script>\n"
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class GetRemoteAnnouncement
|
||||
@queue = :high
|
||||
|
||||
def self.perform()
|
||||
%x(ruby "#{Rails.root}/lib/remote_announcement.rb")
|
||||
end
|
||||
end
|
||||
@@ -42,7 +42,6 @@ class User
|
||||
|
||||
before_create :initialize_desktop
|
||||
before_save :rebuild_status_record
|
||||
before_save :save_roles
|
||||
scope :remote_account, where(:nccu_id.ne => nil)
|
||||
scope :not_guest_user, all_of(:name.ne => "guest")
|
||||
|
||||
@@ -89,9 +88,9 @@ class User
|
||||
var[:id].each do |id,val|
|
||||
# binding.pry if id == '5052c5b22b5c49ab02000004'
|
||||
if (val=="true")
|
||||
self.roles = self.roles.reject{|t| t.id.to_s==id}
|
||||
self.role_ids.reject!{|t| t.to_s == id}
|
||||
elsif(val=="false")
|
||||
self.roles << Role.find(id)
|
||||
self.role_ids += Array(id)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -106,9 +105,9 @@ class User
|
||||
# binding.pry if id == '5052c5b22b5c49ab02000004'
|
||||
|
||||
if ( self.roles.include?(@roid) == false or val=="true")
|
||||
self.sub_roles = self.sub_roles.reject{|t| t.id.to_s==id}
|
||||
self.sub_role_ids.reject!{|t| t.to_s == id}
|
||||
elsif(val=="false")
|
||||
self.sub_roles << SubRole.find(id)
|
||||
self.sub_role_ids += Array(id)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -273,10 +272,6 @@ class User
|
||||
end
|
||||
|
||||
protected
|
||||
def save_roles
|
||||
# self.roles = self.sub_roles.collect{|t| t.role}.uniq
|
||||
self.roles = self.roles.uniq
|
||||
end
|
||||
|
||||
def rebuild_status_record
|
||||
self.status_record = {}
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>
|
||||
<script type='text/javascript'>
|
||||
jQuery(function( $ ){
|
||||
|
||||
$('#slideshow-<%= @ad_banner.title.dehumanize %>').cycle({
|
||||
delay: -1000,
|
||||
fx: "<%= @ad_banner.ad_fx.nil? ? 'fade': @ad_banner.ad_fx %>",
|
||||
timeoutFn: getTimeout,
|
||||
pager: '.banner_nav-<%= @ad_banner.title.dehumanize %>',
|
||||
pagerAnchorBuilder: function(idx, slide) {
|
||||
return "<li><a href='#'></a></li>";
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div style='position:relative'>
|
||||
<ul id='banner_nav' class='clear banner_nav-<%= @ad_banner.title.dehumanize %>'></ul>
|
||||
<div id='slideshow-<%= @ad_banner.title.dehumanize %>' class='slideshow'>
|
||||
@@ -24,3 +8,15 @@
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<script type='text/javascript'>
|
||||
var banner = {"banner_name":"#slideshow-<%= @ad_banner.title.dehumanize %>",
|
||||
"banner_fx":"<%= @ad_banner.ad_fx.nil? ? 'fade': @ad_banner.ad_fx %>",
|
||||
"banner_pager":".banner_nav-<%= @ad_banner.title.dehumanize %>",
|
||||
"image_count":"<%= @ad_banner.ad_images.length %>",
|
||||
"image_loaded":0,
|
||||
"time_to_next":<%= @ad_banner.transition_msec %>,
|
||||
"current":0,
|
||||
"best_size": "<%= @ad_banner.best_size %>"
|
||||
};
|
||||
banners.push(banner);
|
||||
</script>
|
||||
@@ -11,7 +11,8 @@ backup_server:
|
||||
description: BackupServer and remove old backups
|
||||
|
||||
update_tag_cloud:
|
||||
cron: 0 0 [0,12] * * *
|
||||
# cron: 0 0 [0,12] * * *
|
||||
cron: 0 0 0 * * *
|
||||
class: UpdateTagCloud
|
||||
args:
|
||||
description: UpdateTagCloud
|
||||
@@ -23,7 +24,14 @@ generate_system_summary:
|
||||
description: Generate the system status such as disk free space,package version list for showing at site tab
|
||||
|
||||
email_cron:
|
||||
cron: 0 0 [10,16,22] * * *
|
||||
# cron: 0 0 [10,16,22] * * *
|
||||
cron: 0 0 10 * * *
|
||||
class: EmailCron
|
||||
args:
|
||||
description: EmailCron
|
||||
|
||||
get_remote_announcement:
|
||||
cron: */5 * * * * *
|
||||
class: GetRemoteAnnouncement
|
||||
args:
|
||||
description: GetRemoteAnnouncement
|
||||
@@ -3,6 +3,8 @@ Orbit::Application.routes.draw do
|
||||
|
||||
|
||||
|
||||
devise_for :users,:controllers => {:sessions => 'sessions'}
|
||||
|
||||
devise_for :users do
|
||||
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
|
||||
end
|
||||
|
||||
@@ -32,13 +32,7 @@ module ParserFrontEnd
|
||||
ret = ''
|
||||
part = PagePart.find(front['part_id']) if front['part_id']
|
||||
ret << eval("\"#{front['path']}\"") rescue ''
|
||||
args.each do |index,arg|
|
||||
if index=="tag_id" || index=="category_id"
|
||||
ret << (ret.include?("?") ? "&#{index}[]=#{arg}": "?#{index}[]=#{arg}" )
|
||||
else
|
||||
ret << (ret.include?("?") ? "&#{index}=#{arg}": "?#{index}=#{arg}" )
|
||||
end
|
||||
end if args
|
||||
ret << (ret.include?("?") ? "&#{args.to_param}" : "?#{args.to_param}") if args
|
||||
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>")
|
||||
end
|
||||
front.swap(fragment)
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
require 'mongo'
|
||||
require 'open-uri'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
@db = Mongo::Connection.new("localhost", 27017).db("fgu_orbit")
|
||||
@coll_bulletin = @db["bulletins"]
|
||||
@bulletin_links = @db["bulletin_links"]
|
||||
@coll_cat = @db["bulletin_categories"]
|
||||
@updated_bulletins = Array.new
|
||||
|
||||
@categories = @coll_cat.find().to_a.inject({}) do |categories, category|
|
||||
categories[category['key']] = category['_id']
|
||||
categories
|
||||
end
|
||||
|
||||
|
||||
def save_bulletin_links bulletin_id, title, url, c_time
|
||||
|
||||
title = "Link" if title == ''
|
||||
|
||||
bulletin_link = {
|
||||
title: {"zh_tw" => title, "en" => title },
|
||||
url: url,
|
||||
bulletin_id: bulletin_id,
|
||||
created_at: c_time,
|
||||
updated_at: c_time
|
||||
}
|
||||
@bulletin_links.save(bulletin_link)
|
||||
|
||||
end
|
||||
|
||||
def get_remote_bulletins_json(url)
|
||||
data = ""
|
||||
open(url){|f| f.each_line {|line| data << line} }
|
||||
|
||||
bulletins = JSON.parse data
|
||||
|
||||
bulletins.each do |b|
|
||||
|
||||
lang = b[1]=='zh-tw' ? "zh_tw".to_sym : "en".to_sym
|
||||
|
||||
next if b[2]==""
|
||||
next if @categories["#{b[7]}"].nil?
|
||||
|
||||
if b[5]=="" and b[4]!=""
|
||||
b[5]=b[4]
|
||||
b[4]=""
|
||||
end
|
||||
|
||||
bulletin = { _type: "Bulletin",
|
||||
postdate: Time.parse(b[8]),
|
||||
created_at: Time.parse(b[8]),
|
||||
updated_at: Time.parse(b[8]),
|
||||
is_checked: true,
|
||||
is_pending: false,
|
||||
is_rejected: false,
|
||||
bulletin_category_id: @categories["#{b[7]}"],
|
||||
title: {lang => b[2]},
|
||||
subtitle: {lang => b[4]},
|
||||
text: {lang => b[5]},
|
||||
available_for_zh_tw: true,
|
||||
available_for_en: true,
|
||||
create_user_id: "",
|
||||
public: true,
|
||||
sn: b[0],
|
||||
site: b[9],
|
||||
site_id: b[10],
|
||||
is_top: false,
|
||||
is_hot: false,
|
||||
is_hidden: false }
|
||||
|
||||
this_bulletin = @coll_bulletin.find_one(:$and => [{ :sn => bulletin[:sn]},{ :site => bulletin[:site]}])
|
||||
@updated_bulletins.push({:sn => bulletin[:sn],:site => bulletin[:site] })
|
||||
# p bulletin
|
||||
|
||||
unless this_bulletin
|
||||
@coll_bulletin.save(bulletin)
|
||||
|
||||
|
||||
#files
|
||||
(10..14).each do |i|
|
||||
ta = i + 5
|
||||
save_bulletin_links( bulletin[:_id], b[ta], b[i], bulletin[:created_at] ) if b[i] != ''
|
||||
end
|
||||
|
||||
#url
|
||||
save_bulletin_links( bulletin[:_id], '', b[20], bulletin[:created_at] ) if b[20] != ''
|
||||
|
||||
# puts "Inserted "+lang.to_s+" "+bulletin[:title][lang]
|
||||
# p bulletin
|
||||
else
|
||||
@coll_bulletin.update(
|
||||
{"_id"=>this_bulletin["_id"]},
|
||||
{
|
||||
:_type => "Bulletin",
|
||||
:postdate => bulletin[:postdate],
|
||||
:created_at => bulletin[:created_at],
|
||||
:updated_at => bulletin[:updated_at],
|
||||
:is_checked => this_bulletin["is_checked"],
|
||||
:is_pending => this_bulletin["is_pending"],
|
||||
:is_rejected => this_bulletin["is_rejected"],
|
||||
:bulletin_category_id => bulletin[:bulletin_category_id],
|
||||
:title => bulletin[:title],
|
||||
:subtitle => bulletin[:subtitle],
|
||||
:text => bulletin[:text],
|
||||
:available_for_zh_tw => this_bulletin["available_for_zh_tw"],
|
||||
:available_for_en => this_bulletin["available_for_en"],
|
||||
:create_user_id => "",
|
||||
:public => this_bulletin["public"],
|
||||
:sn => bulletin[:sn],
|
||||
:site => bulletin[:site],
|
||||
:site_id => bulletin[:site_id],
|
||||
:is_top => this_bulletin["is_top"],
|
||||
:is_hot => this_bulletin["is_hot"],
|
||||
:is_hidden => this_bulletin["is_hidden"]
|
||||
})
|
||||
|
||||
@bulletin_links.remove(bulletin_id: BSON::ObjectId(this_bulletin["_id"].to_s) )
|
||||
|
||||
#files
|
||||
(10..14).each do |i|
|
||||
ta = i + 5
|
||||
save_bulletin_links( this_bulletin["_id"], b[ta], b[i], this_bulletin["created_at"] ) if b[i] != ''
|
||||
end
|
||||
|
||||
#url
|
||||
save_bulletin_links( this_bulletin["_id"], '', b[20], bulletin[:created_at] ) if b[20] != ''
|
||||
|
||||
# puts "Updated "+lang.to_s+" "+bulletin[:title][lang]
|
||||
# p this_bulletin["_id"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
get_remote_bulletins_json("http://president.fgu.edu.tw/remote_annoucement/get_news2.php")
|
||||
get_remote_bulletins_json("http://car.fgu.edu.tw/remote_annoucement/get_news2.php")
|
||||
|
||||
# Delete bulletins that had been removed form remote sites
|
||||
# Find all remote bulletins on server
|
||||
local_bulletins = @coll_bulletin.find({ site: { :$exists => true } })
|
||||
|
||||
# Check if each remote bulletins on server exist in the updated bulletins
|
||||
local_bulletins.each do |local_bulletin|
|
||||
result = @updated_bulletins.select {|remote_bulletin| remote_bulletin[:sn] == local_bulletin["sn"] and remote_bulletin[:site] == local_bulletin["site"]}
|
||||
if result.length == 0
|
||||
@coll_bulletin.remove(:$and => [{ :sn => local_bulletin["sn"]},{ :site => local_bulletin["site"]}])
|
||||
p "Delete: "+local_bulletin["site"]+"-"+local_bulletin["sn"]
|
||||
end
|
||||
end
|
||||
@@ -326,4 +326,44 @@ namespace :migrate do
|
||||
`mongo #{Mongoid.config.database.name} --eval "db.tags.remove({_type: {$ne: 'Tag'}})"`
|
||||
end
|
||||
|
||||
task :add_missing_user_link => :environment do
|
||||
User.all.each do |user|
|
||||
user.role_ids.uniq!
|
||||
user.sub_role_ids.uniq!
|
||||
user.save
|
||||
user.roles.each do |role|
|
||||
unless role.user_ids.include?(user.id)
|
||||
role.user_ids << user.id
|
||||
role.save
|
||||
end
|
||||
end
|
||||
user.sub_roles.each do |sub_role|
|
||||
unless sub_role.user_ids.include?(user.id)
|
||||
sub_role.user_ids << user.id
|
||||
sub_role.save
|
||||
end
|
||||
end
|
||||
end
|
||||
Role.all.each do |role|
|
||||
role.user_ids.uniq!
|
||||
role.save
|
||||
role.users.each do |user|
|
||||
unless user.role_ids.include?(role.id)
|
||||
user.role_ids << role.id
|
||||
user.save
|
||||
end
|
||||
end
|
||||
end
|
||||
SubRole.all.each do |sub_role|
|
||||
sub_role.user_ids.uniq!
|
||||
sub_role.save
|
||||
sub_role.users.each do |user|
|
||||
unless user.sub_role_ids.include?(sub_role.id)
|
||||
user.sub_role_ids << sub_role.id
|
||||
user.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
+80
-11
@@ -1,26 +1,95 @@
|
||||
$(document).ready(function() {
|
||||
var banners = [];
|
||||
var banner_index = 0;
|
||||
$q = jQuery;
|
||||
$q.getScript('/static/jquery.cycle.all.latest.js');
|
||||
|
||||
$(document).ready(function() {
|
||||
$.each($(".dymanic_load"),function(){
|
||||
if($(this).attr("path")==''){$(this).html("App setting Failed");}
|
||||
|
||||
if($(this).attr("path")!=''){
|
||||
ajax_load_proc($(this),$(this).attr("path"));
|
||||
}
|
||||
if($(this).attr("path").indexOf("show_banner")>0){
|
||||
ajax_load_proc($(this),$(this).attr("path"),"true");
|
||||
}else{
|
||||
ajax_load_proc($(this),$(this).attr("path"),$(this).attr("path"));
|
||||
}
|
||||
);
|
||||
}});
|
||||
$("#main_content").addClass("module");
|
||||
});
|
||||
});
|
||||
|
||||
function ajax_load_proc(wapper,url){
|
||||
function ajax_load_proc(wapper,url,isBanner){
|
||||
$.get(encodeURI(url), {}, function(respText,textSta,XML){
|
||||
if (textSta == 'success') {
|
||||
if (textSta == 'success') {
|
||||
if(isBanner=="true"){
|
||||
wapper.html(respText);
|
||||
};
|
||||
if(textSta == 'error')
|
||||
wapper.html("Loading Failed<br/> <a href='"+$(this).attr('path')+"'>Go See</a>");
|
||||
var banner = banners[banner_index];
|
||||
$(banner.banner_name+" > img").each(function(){
|
||||
$(this).load(function(){ banner.image_loaded++; });
|
||||
});
|
||||
BannerCycle(banner_index);
|
||||
banner_index++;
|
||||
}else{
|
||||
wapper.html(respText);
|
||||
}
|
||||
};
|
||||
if(textSta == 'error')
|
||||
wapper.html("Loading Failed<br/> <a href='"+$(this).attr('path')+"'>Go See</a>");
|
||||
});
|
||||
}
|
||||
|
||||
function BannerCycle(banner_index){
|
||||
var banner = banners[banner_index];
|
||||
if (banner.image_loaded==$(banner.banner_name+" img").length){
|
||||
if(banner.banner_name=="#slideshow-banner"){
|
||||
$q(banner.banner_name).cycle({
|
||||
delay: -1000,
|
||||
fx: banner.banner_fx,
|
||||
timeout: banner.time_to_next,
|
||||
pager: banner.banner_pager,
|
||||
pagerAnchorBuilder: function(idx, slide) { return "<li><a href='#'></a></li>"; }
|
||||
});
|
||||
}else{
|
||||
var width = banner.best_size.split(" x ")[0];
|
||||
var height = banner.best_size.split(" x ")[1];
|
||||
$(banner.banner_name).css( "width", width);
|
||||
$(banner.banner_name).css( "height", height);
|
||||
$(banner.banner_name).css( "display", "block");
|
||||
$(banner.banner_name).css( "overflow", "hidden");
|
||||
$(banner.banner_name+" > img").each(function(){
|
||||
$( this ).css( "position", "absolute" );
|
||||
$( this ).css( "top", "0" );
|
||||
$( this ).css( "left", "0" );
|
||||
$( this ).css( "display", "block" );
|
||||
});
|
||||
if($(banner.banner_name+" > img").length>1) OrbitCycle(banner_index);
|
||||
}
|
||||
}else{
|
||||
setTimeout("BannerCycle("+banner_index+")",500);
|
||||
}
|
||||
}
|
||||
|
||||
function OrbitCycle(banner_index){
|
||||
var banner = banners[banner_index];
|
||||
var index = 0;
|
||||
|
||||
$(banner.banner_name+" > img").each(function(){
|
||||
if(index==banner.current){
|
||||
$( this ).css( "z-index", $(banner.banner_name+" img").length+1);
|
||||
$(this).fadeTo( "slow" , 1);
|
||||
}else{
|
||||
$( this ).css( "z-index", index);
|
||||
$(this).fadeTo( "slow" , 0);
|
||||
}
|
||||
index++;
|
||||
});
|
||||
if((banner.current+1)<$(banner.banner_name+" img").length){
|
||||
banner.current++;
|
||||
}else{
|
||||
banner.current=0;
|
||||
}
|
||||
// console.log("OrbitCycle: "+banner_index);
|
||||
setTimeout("OrbitCycle("+banner_index+")",banner.time_to_next);
|
||||
}
|
||||
|
||||
// Ad Banner FX code [start]
|
||||
function getTimeout() {
|
||||
return $(this).attr('time_to_next');
|
||||
|
||||
vendor/built_in_modules/announcement/app/assets/stylesheets/announcement/bulletins_and_web_links.css
Vendored
+78
@@ -0,0 +1,78 @@
|
||||
|
||||
.mega_tab_block {
|
||||
clear: both;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.mega_tab_block h3 {
|
||||
font: 22px/100% 'arial',sans-serif;
|
||||
margin: 0 0 10px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.mega_tab_block .pagination {
|
||||
float: left;
|
||||
height: auto;
|
||||
margin: 10px 0 0;
|
||||
width: auto;
|
||||
}
|
||||
.mega_tab_block .pagination a {
|
||||
background: none repeat scroll 0 0 #EEEEEE;
|
||||
display: block;
|
||||
float: left;
|
||||
margin: 0 5px 0 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
|
||||
.tag_block {
|
||||
clear: both;
|
||||
margin: 0 0 20px;
|
||||
position: relative;
|
||||
}
|
||||
.mega_tab_block .tag_list {
|
||||
background: none repeat scroll 0 0 #EEEEEE;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
padding: 0 0 0 5px;
|
||||
}
|
||||
.mega_tab_block .tag_list li {
|
||||
float: left;
|
||||
list-style: none outside none;
|
||||
}
|
||||
.mega_tab_block .tag_list li a {
|
||||
background: none repeat scroll 0 0 #DDDDDD;
|
||||
float: left;
|
||||
margin: 0 5px 0 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.news_block {
|
||||
clear: both;
|
||||
margin: 0 0 20px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
.mega_tab_block .news_list {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.mega_tab_block .news_list li {
|
||||
list-style: none outside none;
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
|
||||
.links_block {
|
||||
clear: both;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
.mega_tab_block .links_list {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.mega_tab_block .links_list li {
|
||||
list-style: none outside none;
|
||||
padding: 5px 0;
|
||||
}
|
||||
+65
-4
@@ -66,14 +66,75 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||
|
||||
end
|
||||
|
||||
def bulletins_and_web_links
|
||||
|
||||
@part = PagePart.find(params[:part_id]) if !params[:part_id].blank?
|
||||
|
||||
@title = @part.title_translations[I18n.locale.to_s]
|
||||
|
||||
if !@part.blank? and @part.widget_data_count
|
||||
@page_num = @part.widget_data_count
|
||||
else
|
||||
@page_num = 5
|
||||
end
|
||||
|
||||
date_now = Time.now
|
||||
|
||||
if !params[:tag_id].blank?
|
||||
@tags = Tag.any_in(:_id => params[:tag_id]).asc(:created_at)
|
||||
elsif params[:tag_id].blank? and !@part.tag.blank?
|
||||
@tags = Tag.any_in(:_id => @part.tag).asc(:created_at)
|
||||
else
|
||||
@ModuleApp_b = ModuleApp.first(:conditions => {:key=>'announcement'})
|
||||
@tags = Tag.where(:module_tag_id => @ModuleApp_b.id).asc(:created_at)
|
||||
end
|
||||
|
||||
@selected_tag = Tag.find(params[:id]).first rescue @tags[0]
|
||||
|
||||
@bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:tagged_ids => @selected_tag.id.to_s, :is_hidden => false).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) rescue nil
|
||||
|
||||
if @part.widget_style == 'bulletins_and_web_links'
|
||||
@ModuleApp_w = ModuleApp.first(:conditions => {:key=>'web_resource'})
|
||||
@link_selected_tag = Tag.first(:conditions => {:name => @selected_tag.name, :module_tag_id => @ModuleApp_w.id})
|
||||
@web_links = WebLink.where(:tagged_ids => @link_selected_tag.id.to_s, :is_hidden => false).desc(:is_top,:created_at).available_for_lang(I18n.locale).page(params[:page]).per(@page_num) rescue nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def reload_bulletins
|
||||
@selected_tag = Tag.find(params[:tag_id])
|
||||
@bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:tagged_ids => params[:tag_id]).where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort).page(params[:page]).per(5) rescue nil
|
||||
|
||||
@part = PagePart.find(params[:part_id]) if !params[:part_id].blank?
|
||||
|
||||
@title = @part.title_translations[I18n.locale.to_s]
|
||||
|
||||
if !@part.blank? and @part.widget_data_count
|
||||
@page_num = @part.widget_data_count
|
||||
else
|
||||
@page_num = 5
|
||||
end
|
||||
|
||||
date_now = Time.now
|
||||
|
||||
@selected_tag = Tag.find(params[:tag_id]).first
|
||||
@bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:tagged_ids => @selected_tag.id.to_s, :is_hidden => false).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) rescue nil
|
||||
end
|
||||
|
||||
def reload_web_links
|
||||
@selected_tag = Tag.find(params[:tag_id])
|
||||
@web_links = WebLink.where(:name => @selected_tag.name).where(:is_hidden => false).desc(:is_top, sort).available_for_lang(I18n.locale).page(params[:page]).per(5) rescue nil
|
||||
|
||||
@part = PagePart.find(params[:part_id]) if !params[:part_id].blank?
|
||||
|
||||
if !@part.blank? and @part.widget_data_count
|
||||
@page_num = @part.widget_data_count
|
||||
else
|
||||
@page_num = 5
|
||||
end
|
||||
|
||||
date_now = Time.now
|
||||
|
||||
@selected_tag = Tag.find(params[:tag_id]).first
|
||||
@ModuleApp = ModuleApp.first(:conditions => {:key=>'web_resource'})
|
||||
@link_selected_tag = Tag.first(:conditions => {:name => @selected_tag.name, :module_tag_id => @ModuleApp.id})
|
||||
@web_links = WebLink.where(:tagged_ids => @link_selected_tag.id.to_s, :is_hidden => false).desc(:is_top,:created_at).available_for_lang(I18n.locale).page(params[:page]).per(@page_num) rescue nil
|
||||
end
|
||||
|
||||
def bulletins_side_bar
|
||||
|
||||
@@ -85,7 +85,7 @@ class Bulletin
|
||||
end
|
||||
|
||||
def share_item
|
||||
Item.first(conditions:{name: 'announcement'})
|
||||
Item.first(conditions:{name: 'news'})
|
||||
end
|
||||
|
||||
def proc_check(check,not_pass_info = "")
|
||||
|
||||
Vendored
+2
-1
@@ -3,6 +3,7 @@
|
||||
<div class="info">
|
||||
<div class="info1">
|
||||
<span class="pull-right"><%= dislpay_view_count(@bulletin) %></span>
|
||||
<span class="pull-right"><%= share_links(@bulletin, 'announcement') %></span>
|
||||
<span class="date"><%= display_date_time(@bulletin.postdate) %></span>
|
||||
<% unit = @bulletin.cache_dept[I18n.locale.to_s] rescue nil %>
|
||||
<span><%= link_to unit,panel_announcement_front_end_index_bulletins_by_unit_path(:name=>unit) unless unit.blank? %></span>
|
||||
@@ -38,4 +39,4 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= share_links(@bulletin, 'announcement') %>
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
<% @bulletins.each do |bulletin| %>
|
||||
<li>
|
||||
<%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id , :tag_id => @selected_tag.id ) %>
|
||||
<%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id , :part_id => params[:part_id], :tag_id => [@selected_tag.id] ) %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<div class='pagination'>
|
||||
<%= link_to_previous_page @bulletins, 'Previous Page', :params => {:controller => 'widget/bulletins', :action => 'reload_bulletins', :tag_id => @selected_tag.id}, :remote => true, :class => 'previous' %>
|
||||
<%= link_to_next_page @bulletins, 'Next Page', :params => {:controller => 'widget/bulletins', :action => 'reload_bulletins', :tag_id => @selected_tag.id}, :remote => true, :class => 'next' %>
|
||||
<%= link_to_previous_page @bulletins, 'Previous Page', :params => {:controller => 'widget/bulletins', :action => 'reload_bulletins', :part_id => params[:part_id], :tag_id => [@selected_tag.id]}, :remote => true, :class => 'previous' %>
|
||||
<%= link_to_next_page @bulletins, 'Next Page', :params => {:controller => 'widget/bulletins', :action => 'reload_bulletins', :part_id => params[:part_id], :tag_id => [@selected_tag.id]}, :remote => true, :class => 'next' %>
|
||||
</div>
|
||||
Vendored
+1
-1
@@ -1,3 +1,3 @@
|
||||
<li>
|
||||
<%= link_to tag.name, panel_announcement_widget_bulletins_and_web_links_path(:id => tag.id), :remote => true, :class => ('active' if tag.eql?(@selected_tag)) %>
|
||||
<%= link_to tag.name, panel_announcement_widget_bulletins_and_web_links_path(:inner=>true, :id => [tag.id], :part_id=>params[:part_id]), :remote => true, :class => ('active' if tag.eql?(@selected_tag)) %>
|
||||
</li>
|
||||
+2
-2
@@ -5,6 +5,6 @@
|
||||
<% end %>
|
||||
|
||||
<div class='pagination'>
|
||||
<%= link_to_previous_page @web_links, 'Previous Page', :params => {:controller => 'widget/bulletins', :action => 'reload_web_links', :tag_id => @selected_tag.id}, :remote => true, :class => 'previous' %>
|
||||
<%= link_to_next_page @web_links, 'Next Page', :params => {:controller => 'widget/bulletins', :action => 'reload_web_links', :tag_id => @selected_tag.id}, :remote => true, :class => 'next' %>
|
||||
<%= link_to_previous_page @web_links, 'Previous Page', :params => {:controller => 'widget/bulletins', :action => 'reload_web_links', :part_id => params[:part_id], :tag_id => @selected_tag.id}, :remote => true, :class => 'previous' %>
|
||||
<%= link_to_next_page @web_links, 'Next Page', :params => {:controller => 'widget/bulletins', :action => 'reload_web_links', :part_id => params[:part_id], :tag_id => @selected_tag.id}, :remote => true, :class => 'next' %>
|
||||
</div>
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<div class="mega_tab_block">
|
||||
|
||||
<div class="tag_block">
|
||||
<ul id='bulletins_web_links_tags' class="tag_list">
|
||||
<%= render :partial => 'tag', :collection => @tags %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="news_block">
|
||||
<h3 class="news_title2">
|
||||
<%#= link_to t("announcement.bulletins"), panel_announcement_front_end_bulletins_path, :class => 'more' %>
|
||||
<%= link_to @title, panel_announcement_front_end_bulletins_path, :class => 'more' %>
|
||||
</h3>
|
||||
<ul id='bulletins_web_links_bulletins' class="news_list">
|
||||
<%= render 'bulletins' if @bulletins %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<% if @part.widget_style == 'bulletins_and_web_links' %>
|
||||
|
||||
<div class="links_block">
|
||||
<h3 class="links_title"><%= t(:related_links) %></h3>
|
||||
<ul id='bulletins_web_links_web_links' class="links_list">
|
||||
<%= render 'web_links' if @web_links %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "news_link" %>
|
||||
<% end %>
|
||||
|
||||
<%= stylesheet_link_tag "announcement/bulletins_and_web_links" %>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
$('#bulletins_web_links_tags').html("<%= j render :partial => 'tag', :collection => @tags %>")
|
||||
$('#bulletins_web_links_bulletins').html("<%= j render 'bulletins' if @bulletins %>")
|
||||
$('#bulletins_web_links_web_links').html("<%= j render 'web_links' if @web_links %>")
|
||||
@@ -35,6 +35,6 @@ en:
|
||||
update_bulletin_category_success: Update Category Successfully
|
||||
url: URL
|
||||
widget:
|
||||
bulletins_and_web_links: Bulletins and Web Resources
|
||||
bulletins_and_web_links: Differential Nav.
|
||||
index: Index
|
||||
search: Search
|
||||
@@ -35,6 +35,6 @@ zh_tw:
|
||||
update_bulletin_category_success: 更新類別成功
|
||||
url: 連結位置
|
||||
widget:
|
||||
bulletins_and_web_links: 索引
|
||||
bulletins_and_web_links: 分眾頁籤
|
||||
index: 索引
|
||||
search: 搜尋
|
||||
@@ -52,6 +52,11 @@ module Announcement
|
||||
widget_i18n "announcement.widget.search"
|
||||
end
|
||||
|
||||
customize_widget "bulletins_and_web_links" do
|
||||
widget_i18n "announcement.widget.bulletins_and_web_links"
|
||||
style ["bulletins_and_links","bulletins_only"]
|
||||
end
|
||||
|
||||
# item "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"]
|
||||
# item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links"
|
||||
end
|
||||
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
+27
-4
@@ -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
|
||||
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
class Panel::Location::BackEnd::LocationCategoriesController < OrbitBackendController
|
||||
|
||||
def index
|
||||
@categorylist = LocationCategory.all
|
||||
@new_category = LocationCategory.new
|
||||
end
|
||||
|
||||
def create
|
||||
@category = LocationCategory.new(params[:location_category])
|
||||
@category.save!
|
||||
respond_to do |h|
|
||||
h.js
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@category = LocationCategory.find(params[:id])
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def update
|
||||
@category = LocationCategory.find(params[:id])
|
||||
@category.update_attributes(params[:location_category])
|
||||
respond_to do |h|
|
||||
h.js
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@category = LocationCategory.find(params['id'])
|
||||
@category.delete
|
||||
render :json=>{"success"=>"true"}.to_json
|
||||
end
|
||||
|
||||
end
|
||||
Vendored
-1
@@ -14,7 +14,6 @@ class Panel::Location::BackEnd::LocationsController < OrbitBackendController
|
||||
|
||||
def new
|
||||
@location_info = LocationInfo.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @location }
|
||||
|
||||
@@ -8,4 +8,6 @@ class Location
|
||||
field :description
|
||||
field :longitude, type: Float
|
||||
field :latitude, type: Float
|
||||
|
||||
belongs_to :location_category
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
class LocationCategory
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
# include OrbitCoreLib::ObjectAuthable
|
||||
|
||||
# ObjectAuthTitlesOptions = %W{new_album}
|
||||
# APP_NAME = "album"
|
||||
|
||||
field :name, localize: true
|
||||
|
||||
has_many :location_infos, :autosave => true, :dependent => :destroy
|
||||
|
||||
end
|
||||
@@ -9,6 +9,8 @@ class LocationInfo
|
||||
field :longitude, type: Float
|
||||
field :latitude, type: Float
|
||||
|
||||
belongs_to :location_category
|
||||
|
||||
validates :file, presence: true
|
||||
validates :longitude,
|
||||
numericality: { less_than_or_equal_to: 180.0, greater_than_or_equal_to: -180.0 },
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<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] rescue nil %> </span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="action">
|
||||
<%= link_to(t(:delete_), panel_location_back_end_location_category_path(category), :method => :delete, :confirm => t("sure?"), :remote => true, :class => "delete") %>
|
||||
<%= link_to(t(:edit), edit_panel_location_back_end_location_category_path(category), :remote => true, :class => "edit") %>
|
||||
<%#= show_gallery_category_permission_link(category) %>
|
||||
</div>
|
||||
</div>
|
||||
vendor/built_in_modules/location/app/views/panel/location/back_end/location_categories/create.js.erb
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
var dom = $("<%= j render :partial => 'category', :object => @category %>");
|
||||
$("div#tags").append(dom);
|
||||
vendor/built_in_modules/location/app/views/panel/location/back_end/location_categories/edit.html.erb
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
<%= form_for @category, :url => panel_location_back_end_location_category_path(@category), :remote => true do |f| %>
|
||||
<%= f.fields_for :name_translations do |name| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<%= label_tag(locale,t("location.new_category")+"["+I18nVariable.from_locale(locale)+"]") %>
|
||||
<%= name.text_field locale, :value =>(@category.name_translations[locale]) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= f.submit "Save", :class=> "btn btn-primary temp_save_btn" %>
|
||||
<a href="#" class="btn btn-primary" id="temp_cancel_btn" onclick="return false;"><%= I18n.t(:cancel) %></a>
|
||||
<% end %>
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
<div id="tags" class="clear">
|
||||
<%= render :partial => 'category', :collection => @categorylist %>
|
||||
</div>
|
||||
<div class="form-actions form-fixed form-inline pagination-right">
|
||||
<%= form_for @new_category, :url => {:action => "create"}, :remote => true do |f| %>
|
||||
<%= f.fields_for :name_translations do |name| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<%= label_tag(locale,t("location.new_category")+"["+I18nVariable.from_locale(locale)+"]") %>
|
||||
<%= name.text_field locale %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= f.submit "Save", :class=> "btn btn-primary" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var deleteCategory = function(a){
|
||||
var parent = a.parent().parent();
|
||||
parent.hide("slide",function(){parent.remove();})
|
||||
}
|
||||
var parent;
|
||||
var editCategory = function(a,data){
|
||||
parent = a.parent().parent();
|
||||
var parenthtml = parent.html();
|
||||
var tempdom = $("<div class='tagitem'></div>");
|
||||
tempdom.append(data);
|
||||
parent.html(tempdom);
|
||||
tempdom.find("a#temp_cancel_btn").click(function(){
|
||||
parent.html(parenthtml);
|
||||
})
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$("#tags div.action a.delete").live('ajax:success', function(){
|
||||
deleteCategory($(this));
|
||||
})
|
||||
$("#tags div.action a.edit").live('ajax:success',function(evt, data, status, xhr){
|
||||
editCategory($(this),data);
|
||||
})
|
||||
})
|
||||
</script>
|
||||
vendor/built_in_modules/location/app/views/panel/location/back_end/location_categories/update.js.erb
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
var dom = $("<%= j render :partial => 'category', :object => @category %>");
|
||||
parent.html(dom.html());
|
||||
Vendored
+7
-1
@@ -9,6 +9,12 @@
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for=""><%= t "category" %></label>
|
||||
<div class="controls">
|
||||
<%= f.select(:location_category_id, LocationCategory.all.collect {|p| [ p.name, p.id ] },{:prompt => t("location.select_category")},:class => "validate input-xlarge") %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for=""><%= t 'picture' %></label>
|
||||
<div class="controls">
|
||||
@@ -20,7 +26,7 @@
|
||||
<label class="control-label" for=""><%= t 'coordinates' %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :longitude, :class=>"span2", :placeholder => "Longitude" %>
|
||||
<%= f.text_field :latitude, :class=>"span2", :placeholder => "Langitude" %>
|
||||
<%= f.text_field :latitude, :class=>"span2", :placeholder => "Lantitude" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
<%= form_for @location_info, :url=> panel_location_back_end_locations_path, :html => { :class=>"form-horizontal"} do |f| %>
|
||||
<%= form_for @location_info, :url=> panel_location_back_end_locations_path, :html => { :class=>"form-horizontal",:multipart => true} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
+4
-1
@@ -1,3 +1,6 @@
|
||||
en:
|
||||
location:
|
||||
location: Location
|
||||
locations: Locations
|
||||
new_category: "New Category"
|
||||
save: Save
|
||||
select_category: "Select Category"
|
||||
@@ -6,6 +6,7 @@ Rails.application.routes.draw do
|
||||
match "locations/get_locations" => "locations#get_locations"
|
||||
|
||||
resources :locations
|
||||
resources :location_categories
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+9
-2
@@ -1,6 +1,6 @@
|
||||
module Location
|
||||
OrbitApp.registration "Location",:type=> 'ModuleApp' do
|
||||
module_label 'location.location'
|
||||
module_label 'locations'
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
# personal_plugin :enable => true,:path=>"panel/location/plugin/profile",:i18n=>'admin.location'
|
||||
|
||||
@@ -32,12 +32,19 @@ module Location
|
||||
# end
|
||||
|
||||
side_bar do
|
||||
head_label_i18n 'location.location',:icon_class=>"icons-location"
|
||||
head_label_i18n 'locations',:icon_class=>"icons-location"
|
||||
available_for [:admin,:guest,:manager,:sub_manager]
|
||||
active_for_controllers ({:private=>['locations']})
|
||||
|
||||
head_link_path "panel_location_back_end_locations_path"
|
||||
|
||||
context_link 'categories',
|
||||
:link_path=>"panel_location_back_end_location_categories_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{:localtion_categories=>:index},
|
||||
:available_for => [:manager]
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/index.html.erb
Vendored
+6
-4
@@ -10,10 +10,12 @@
|
||||
<div class="o-links-list">
|
||||
<ul>
|
||||
<% web_links.page(params[:page_main]).per(@page_num).each do |web_link| %>
|
||||
<li>
|
||||
<%= link_to web_link.title, web_link.url, {:target => '_blank', :title => web_link.title, :class=>"o-links-title"} %>
|
||||
<div class="o-links-description"><%= web_link.context %></div>
|
||||
</li>
|
||||
<% if !web_link.title.empty? %>
|
||||
<li>
|
||||
<%= link_to web_link.title, web_link.url, {:target => '_blank', :title => web_link.title, :class=>"o-links-title"} %>
|
||||
<div class="o-links-description"><%= web_link.context %></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Vendored
+6
-4
@@ -8,10 +8,12 @@
|
||||
<div class="o-links-list">
|
||||
<ul>
|
||||
<% web_links.page(params[:page_main]).per(@page_num).each do |web_link| %>
|
||||
<li>
|
||||
<%= link_to web_link.title, web_link.url, {:target => '_blank', :title => web_link.title, :class=>"o-links-title"} %>
|
||||
<div class="o-links-description"><%= web_link.context %></div>
|
||||
</li>
|
||||
<% if !web_link.title.empty? %>
|
||||
<li>
|
||||
<%= link_to web_link.title, web_link.url, {:target => '_blank', :title => web_link.title, :class=>"o-links-title"} %>
|
||||
<div class="o-links-description"><%= web_link.context %></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<ul>
|
||||
<% @web_links.each do |widget| -%>
|
||||
<li><%= link_to widget.title, widget.url, {:target => '_blank', :title => widget.title} %></li>
|
||||
<li><%= link_to widget.title, widget.url, {:target => '_blank', :title => widget.title} %></li>
|
||||
<% end -%>
|
||||
</ul>
|
||||
|
||||
|
||||
Reference in new issue
Block a user