Merge branch 'master' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 into gravity

This commit is contained in:
Harry Bomrah 2015-06-05 14:25:32 +08:00
commit 1ee6b4cc67
15 changed files with 361 additions and 146 deletions

View File

@ -191,8 +191,8 @@
}
}
// 67.5rem
@media screen and (min-width: 1080px) {
// 1080px
@media screen and (min-width: 67.5rem) {
.group-card {
width: 25%;
@ -209,7 +209,7 @@
}
// 1400px
@media screen and (min-width: 1400px) {
@media screen and (min-width: 87.5rem) {
.group-card {
width: 20%;

View File

@ -60,7 +60,7 @@
.group-member-item {
list-style: none;
padding: 8px 0.75rem;
padding: 16px 1rem;
margin: 8px 0 12px 0;
}
@ -73,6 +73,7 @@
.group-member-meta-wrap {
display: inline-block;
vertical-align: top;
width: 50%;
}
.group-member-name {
@ -113,21 +114,26 @@
}
// 480px
@media screen and (min-width: 30rem) {
// 620
@media screen and (min-width: 38.75rem) {
.group-member-item {
float: left;
margin-right: 1rem;
width: 45%;
}
}
// 760px
// 980px
@media screen and (min-width: 47.5rem) {
@media screen and (min-width: 61.25rem) {
.group-member-content-wrap {
width: 70%;
}
.group-member-item {
width: 30%;
}
.group-member-page-title {
display: inline-block;
margin: 0;
@ -135,4 +141,12 @@
line-height: 70px;
transition: .6s all;
}
}
// 1400px
@media screen and (min-width: 87.5rem) {
.group-member-item {
width: 20%;
}
}

View File

@ -35,6 +35,8 @@ class Admin::StoreController < OrbitAdminController
response = http.request(request)
data = JSON.parse(response.body)
render :json => data.to_json
%x(kill -s USR2 `cat tmp/pids/unicorn.pid`)
sleep 5
end
def authorize_default_modules

View File

@ -214,11 +214,11 @@ class PagesController < ApplicationController
{"key" => "email", "human_readable" => I18n.t("users.email")}
]
custom_attribs = MemberProfileField.all.collect do |mpf|
custom_attribs = MemberProfileField.all.asc(:created_at).collect do |mpf|
{"key" => mpf.key, "human_readable" => mpf.title}
end
role_attribs = AttributeField.all.collect do |af|
role_attribs = AttributeField.all.asc(:created_at).collect do |af|
{"key" => af.key, "human_readable" => af.title}
end

View File

@ -23,13 +23,6 @@
text-align: center;
font-size: 0.8125rem;
}
.loading {
&:after {
content: '\f1ce';
font-family: FontAwesome;
animation: 2s linear 0s normal none infinite running fa-spin;
}
}
}
.w-calendar-table {
margin-bottom: 0;
@ -40,6 +33,7 @@
.w-calendar-event {
background: $theme-color-third;
color: $theme-white;
cursor: pointer;
}
}
@ -56,11 +50,3 @@
right: 10px;
}
}
@keyframes fa-spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(359deg);
}
}

View File

@ -12,6 +12,7 @@
<header class="navbar layout-header" role="navigation">
<div class="container">
<div class="header-nav" >
<a id="accesskey_top" accesskey="Q" href="/<%= "#{locale.to_s}" %>/accesskey" title="Toolbar">:::</a>
{{header-data}}
</div>
<div class="navbar-header">
@ -24,6 +25,7 @@
<a class="navbar-brand" href="/"><img class="site-logo" src="{{logo_url}}" alt="Site Logo"> {{site_name}}</a>
</div>
<div class="collapse navbar-collapse modules-menu" id="layout-navigation">
<a id="accesskey_menu" accesskey="M" href="/<%= "#{locale.to_s}" %>/accesskey" title="Main menu">:::</a>
<%= render_menu %>
</div>
</div>

View File

@ -8,6 +8,7 @@
<%= render_header %>
<section class="layout-slide" data-pp="300"></section>
<div class="layout-content">
<a id="accesskey_content" accesskey="C" href="/<%= "#{locale.to_s}" %>/accesskey" title="Content">:::</a>
<div class="layout-content-inner container">
<section class="layout-content-box" data-pp="1"></section>
<div class="row">

View File

@ -1,58 +0,0 @@
<div class="w-calendar widget-calendar-1" data-module="calendar">
<div class='month_template'>
<h4 class="widget-title ">
<span class="text"></span>
<i class="fa fa-circle-o-notch fa-spin fa-fw loading hide"></i>
</h4>
<div class="w-calendar-nav">
<a href="#" class="w-calendar-nav-prev">
<i class="fa fa-chevron-left"></i>
<span class="w-calendar-nav-prev-text hide">Prev</span>
</a>
<a href="#" class="w-calendar-nav-next">
<i class="fa fa-chevron-right"></i>
<span class="w-calendar-nav-next-text hide">Next</span>
</a>
</div>
<table class="table table-condensed w-calendar-table">
<thead>
<tr>
<th>Sun</th>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thu</th>
<th>Fri</th>
<th>Sat</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<script>
if(document.getElementById("calendar-widget_module") == null){
var tag = document.createElement('script');
tag.setAttribute("id", "calendar-widget_module");
tag.src = "/assets/calendar_widget.js";
tag.onload = function(){
$("div[data-module=calendar]").each(function(index){
var calendar = $(this),
cmi = new CalendarModuleMonth(new Date(), calendar,calendar.data("subpart-id"));
cmi.currentMonth();
calendar.find("div.w-calendar-nav a").on("click",function(){
var el = $(this);
if(el.hasClass("w-calendar-nav-prev")){
cmi.prevMonth();
}else if(el.hasClass("w-calendar-nav-next")){
cmi.nextMonth();
}
return false;
})
})
}
var head = document.getElementsByTagName("head");
head[0].appendChild(tag);
}
</script>

View File

@ -1,40 +0,0 @@
<div id="orbit_calendar">
<div id="sec1">
<div class="btn-toolbar" id="navigation">
<div id="calendar-nav">
<div class="btn-group">
<button class="btn btn-default btn-sm" id="prev_month_btn">
<i class="icon-chevron-left"></i>
</button>
<button class="btn btn-default btn-sm" id="next_month_btn">
<i class="icon-chevron-right"></i>
</button>
<button class="btn btn-default btn-sm" id="today_btn">Today</button>
</div>
</div>
</div>
<div class="form-inline" id="range_selection"></div>
</div>
<div id='sec3' class="btn-toolbar">
<div class="btn-group calendar_mode">
<button class="btn btn-default mode_switch btn-sm" data-mode="agendaDay" >day</button>
<button class="btn btn-default mode_switch btn-sm" data-mode="agendaWeek" >week</button>
<button class="btn btn-default active mode_switch btn-sm" data-mode="month" >month</button>
<button class="btn btn-default mode_switch btn-sm" data-mode="agenda" >agenda</button>
</div>
<button id="refresh_btn" class="btn btn-default btn-sm">
<i class="icons-cycle"></i>
</button>
</div>
<div id="view_holder">
<h3 id="current_title" class="current_day_title"></h3>
<div id="calendar"></div>
<div id="calendar_agenda"></div>
</div>
</div>
<div id="event_quick_view" class="modal" style="width: 300px; display:none; margin:0 0 0 0;"></div>
<div id="calendar-loading"></div>
<script type="text/javascript">
var calendar = new Calendar("#calendar","{{page_id}}");
</script>

View File

@ -1,22 +0,0 @@
{
"frontend": [
{
"filename" : "index",
"name" : {
"zh_tw" : "1. 行事曆",
"en" : "1. Calendar"
},
"thumbnail" : "thumb.png"
}
],
"widgets" : [
{
"filename" : "calendar_widget1",
"name" : {
"zh_tw" : "1. 行事曆",
"en" : "1. Calendar"
},
"thumbnail" : "thumb.png"
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -1,4 +1,5 @@
<div class="sitemenu-wrap">
<a id="accesskey_sitemenu" accesskey="S" href="/<%= "#{locale.to_s}" %>/accesskey" title="Sitemenu">:::</a>
<h3 class="sitemenu-title">{{widget_title}}</h3>
<ul data-list="pages" class="sitemenu-list level-1" data-level="0">
<li class="sitemenu-item level-1">

View File

@ -46,7 +46,7 @@
<a href="#"><%= gm["name"][I18n.locale.to_s] %></a><br />
<%= gm["user_name"] %><br />
<% if gm["admin"] %>
<span class="label label-danger">Admin</span>
<span class="label label-warning">Admin</span>
<% end %>
</div>
</div>

View File

@ -167,6 +167,7 @@
</li>
<% else %>
<li>
<a id="accesskey_login" class="sr-only" accesskey="L" href="/<%= "#{locale.to_s}" %>/accesskey" title="Login">:::</a>
<label for="open-orbit-login">
<i class="icons-login"></i>
</label>

View File

@ -0,0 +1,328 @@
require "uri"
require "net/http"
namespace :sync_personal_plugins do
task :sync,[:arg] => :environment do |task,args|
MemberProfile.each do |mp|
staff_id = mp.sid rescue nil
if !staff_id.nil? && staff_id != ""
sync_journal_papers(staff_id,mp)
sync_conference_papers(staff_id,mp)
sync_research_papers(staff_id,mp)
sync_books(staff_id,mp)
sync_projects(staff_id,mp)
sync_honors(staff_id,mp)
sync_diplomas(staff_id,mp)
sync_experiences(staff_id,mp)
end
end
end
end
def sync_journal_papers(staff_id,mp)
params_to_send = {"plugin" => "writing","type" => "journal", "staff" => staff_id}
data = get_data(params_to_send)
return if !data["success"].nil?
puts "Starting Jounral Paper for staff #{staff_id}."
total = data["journals"].count
data["journals"].each_with_index do |journal,index|
jp = JournalPaper.where(:rss2_id => journal["rss_id"]).first rescue nil
if jp.nil?
jp = JournalPaper.new
jp.vol_no = journal["number"]
jp.publication_date = "#{journal["publication_year"]}/#{journal["publication_month"]}/01"
jp.rss2_id = journal["rss_id"]
jp.year = "#{journal["publication_year"]}"
jp.url = journal["url"]
jp.paper_title_translations = journal["title"]
jp.member_profile = mp
jp.save
puts "Syncing new : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
else
jp.vol_no = journal["number"]
jp.year = "#{journal["publication_year"]}"
jp.publication_date = "#{journal["publication_year"]}/#{journal["publication_month"]}/01"
jp.url = journal["url"]
jp.paper_title_translations = journal["title"]
jp.save
puts "Updating old : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
end
end
puts "Jounral Paper for staff #{staff_id} completed."
end
def sync_conference_papers(staff_id,mp)
params_to_send = {"plugin" => "writing","type" => "conference", "staff" => staff_id}
data = get_data(params_to_send)
return if !data["success"].nil?
puts "Starting Conference Paper for staff #{staff_id}."
total = data["conferences"].count
data["conferences"].each_with_index do |conference,index|
wc = WritingConference.where(:rss2_id => conference["rss_id"]).first rescue nil
if wc.nil?
wc = WritingConference.new
wc.isi_number = conference["number"]
wc.publication_date = "#{conference["publication_year"]}/#{conference["publication_month"]}/01"
wc.rss2_id = conference["rss_id"]
w.year = "#{conference["publication_year"]}"
wc.url = conference["url"]
wc.paper_title_translations = conference["title"]
wc.member_profile = mp
wc.save
puts "Syncing new : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
else
wc.isi_number = conference["number"]
wc.publication_date = "#{conference["publication_year"]}/#{conference["publication_month"]}/01"
wc.year = "#{conference["publication_year"]}"
wc.url = conference["url"]
wc.paper_title_translations = conference["title"]
wc.save
puts "Updating old : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
end
end
puts "Conference Paper for staff #{staff_id} completed."
end
def sync_research_papers(staff_id,mp)
params_to_send = {"plugin" => "writing","type" => "research", "staff" => staff_id}
data = get_data(params_to_send)
return if !data["success"].nil?
puts "Starting Research Paper for staff #{staff_id}."
total = data["researches"].count
data["researches"].each_with_index do |research,index|
res = Research.where(:rss2_id => research["rss_id"]).first rescue nil
if res.nil?
res = Research.new
res.publish_date = "#{research["publication_year"]}/#{research["publication_month"]}/01"
res.rss2_id = research["rss_id"]
res.url = research["url"]
res.year = research["publication_year"]
res.research_title_translations = research["title"]
res.member_profile = mp
res.save
puts "Syncing new : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
else
res.publish_date = "#{research["publication_year"]}/#{research["publication_month"]}/01"
res.url = research["url"]
res.year = research["publication_year"]
res.research_title_translations = research["title"]
res.save
puts "Updating old : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
end
end
puts "Research Paper for staff #{staff_id} completed."
end
def sync_books(staff_id,mp)
params_to_send = {"plugin" => "writing","type" => "book", "staff" => staff_id}
data = get_data(params_to_send)
return if !data["success"].nil?
puts "Starting Books for staff #{staff_id}."
total = data["books"].count
data["books"].each_with_index do |book,index|
boo = Book.where(:rss2_id => book["rss_id"]).first rescue nil
if boo.nil?
boo = Book.new
boo.publish_date = "#{book["publication_year"]}/#{book["publication_month"]}/01"
boo.rss2_id = book["rss_id"]
boo.url = book["url"]
boo.year = book["publication_year"]
boo.book_title_translations = book["title"]
boo.member_profile = mp
boo.isbn = book["number"]
boo.save
puts "Syncing new : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
else
boo.publish_date = "#{book["publication_year"]}/#{book["publication_month"]}/01"
boo.url = book["url"]
boo.year = book["publication_year"]
boo.book_title_translations = book["title"]
boo.isbn = book["number"]
boo.save
puts "Updating old : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
end
end
puts "Books for staff #{staff_id} completed."
end
def sync_projects(staff_id,mp)
params_to_send = {"plugin" => "project","type" => "xx", "staff" => staff_id}
data = get_data(params_to_send)
return if !data["success"].nil?
puts "Starting Projects for staff #{staff_id}."
total = data["projects"].count
data["projects"].each_with_index do |project,index|
proj = Project.where(:rss2_id => project["rss_id"]).first rescue nil
if proj.nil?
proj = Project.new
proj.period_start_date = project["start_date"]
proj.period_end_date = project["end_date"]
proj.rss2_id = project["rss_id"]
proj.url = project["url"]
proj.year = project["year"]
proj.project_title_translations = project["title"]
proj.job_title_translations = project["job"]
proj.participator_translations = project["participator"]
proj.unit_translations = project["unit"]
proj.member_profile = mp
proj.save
puts "Syncing new : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
else
proj.period_start_date = project["start_date"]
proj.period_end_date = project["end_date"]
proj.url = project["url"]
proj.year = project["year"]
proj.project_title_translations = project["title"]
proj.job_title_translations = project["job"]
proj.participator_translations = project["participator"]
proj.unit_translations = project["unit"]
proj.save
puts "Updating old : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
end
end
puts "Projects for staff #{staff_id} completed."
end
def sync_honors(staff_id,mp)
params_to_send = {"plugin" => "honor","type" => "xx", "staff" => staff_id}
data = get_data(params_to_send)
return if !data["success"].nil?
puts "Starting Honors for staff #{staff_id}."
total = data["honors"].count
data["honors"].each_with_index do |honor,index|
hon = Honor.where(:rss2_id => honor["rss_id"]).first rescue nil
ht = HonorType.where(:title => honor["category"]["zh_tw"]).first rescue nil
ht = HonorType.where(:title => honor["category"]["en"]).first rescue nil
if ht.nil?
ht = HonorType.new
ht.title_translations = honor["category"]
ht.save
end
if hon.nil?
hon = Honor.new
hon.rss2_id = honor["rss_id"]
hon.award_name_translations = honor["title"]
hon.awarding_unit_translations = honor["unit"]
hon.year = honor["year"]
hon.honor_type = ht
hon.member_profile = mp
hon.save
puts "Syncing new : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
else
hon.award_name_translations = honor["title"]
hon.awarding_unit_translations = honor["unit"]
hon.year = honor["year"]
hon.honor_type = ht
hon.save
puts "Updating old : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
end
end
puts "Honors for staff #{staff_id} completed."
end
def sync_diplomas(staff_id,mp)
params_to_send = {"plugin" => "diploma","type" => "xx", "staff" => staff_id}
data = get_data(params_to_send)
return if !data["success"].nil?
puts "Starting Diplomas for staff #{staff_id}."
total = data["diplomas"].count
data["diplomas"].each_with_index do |diploma,index|
dip = Diploma.where(:rss2_id => diploma["rss_id"]).first rescue nil
if dip.nil?
dip = Diploma.new
dip.rss2_id = diploma["rss_id"]
dip.country_translations = diploma["country"]
dip.degree_translations = diploma["degree"]
dip.department_translations = diploma["dept"]
dip.end_date = diploma["end_date"].gsub("-","/").gsub("00","02")
dip.start_date = diploma["start_date"].gsub("-","/").gsub("00","02")
dip.school_name_translations = diploma["school"]
dip.member_profile = mp
dip.save
puts "Syncing new : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
else
dip.country_translations = diploma["country"]
dip.degree_translations = diploma["degree"]
dip.department_translations = diploma["dept"]
dip.end_date = diploma["end_date"].gsub("-","/").gsub("00","02")
dip.start_date = diploma["start_date"].gsub("-","/").gsub("00","02")
dip.school_name_translations = diploma["school"]
dip.save
puts "Updating old : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
end
end
puts "Diplomas for staff #{staff_id} completed."
end
def sync_experiences(staff_id,mp)
params_to_send = {"plugin" => "experience","type" => "xx", "staff" => staff_id}
data = get_data(params_to_send)
return if !data["success"].nil?
puts "Starting Experiences for staff #{staff_id}."
total = data["experiences"].count
data["experiences"].each_with_index do |experience,index|
exp = Experience.where(:rss2_id => experience["rss_id"]).first rescue nil
et = ExperienceType.where(:title => experience["type"]["zh_tw"]).first rescue nil
et = ExperienceType.where(:title => experience["type"]["en"]).first rescue nil
if et.nil?
et = ExperienceType.new
et.title_translations = experience["type"]
et.save
end
if exp.nil?
exp = Experience.new
exp.rss2_id = experience["rss_id"]
exp.department_translations = experience["dept"]
exp.organizationt_title_translations = experience["title"]
exp.end_date = experience["end_date"]
exp.start_date = experience["start_date"]
exp.experience_type = et
exp.member_profile = mp
exp.save
puts "Syncing new : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
else
exp.department_translations = experience["dept"]
exp.organizationt_title_translations = experience["title"]
exp.end_date = experience["end_date"]
exp.start_date = experience["start_date"]
exp.experience_type = et
exp.save
puts "Updating old : " + ((100 * (index +1)) / total).to_s + "%"
sleep 0.5
end
end
puts "Experiences for staff #{staff_id} completed."
end
def get_data(params_to_send)
uri = URI.parse("http://140.119.221.39/sync/?plugin=#{params_to_send["plugin"]}&type=#{params_to_send["type"]}&staff=#{params_to_send["staff"]}")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
data = JSON.parse(response.body) rescue nil
return data
end