Ika's changes

This commit is contained in:
Christophe Vilayphiou committed 2012-02-23 15:53:15 +08:00
1 parent f43646c9b6
commit 1a6e497b3d
16 files changed
+3435 -3465

No files matched your search

@@ -1,66 +1,27 @@
$(document).ready(function(){
$(".tag1").addClass("active");
$(document).on("click", ".tag1", function () {
for (i=1; i<=4; i++){
$("#news_"+i).css("display","none");
$("#links_"+i).css("display","none");
$(".tag"+i).removeClass("active");
}
$("#news_1").fadeIn();
$("#links_1").fadeIn();
$(this).addClass("active");
return false;
});
$(document).on("click", ".tag2", function () {
for (i=1; i<=4; i++){
$("#news_"+i).css("display","none");
$("#links_"+i).css("display","none");
$(".tag"+i).removeClass("active");
}
$("#news_2").fadeIn();
$("#links_2").fadeIn();
$(this).addClass("active");
return false;
});
$(document).on("click", ".tag3", function () {
for (i=1; i<=4; i++){
$("#news_"+i).css("display","none");
$("#links_"+i).css("display","none");
$(".tag"+i).removeClass("active");
}
$("#news_3").fadeIn();
$("#links_3").fadeIn();
$(this).addClass("active");
return false;
});
$(document).on("click", ".tag4", function () {
for (i=1; i<=4; i++){
$("#news_"+i).css("display","none");
$("#links_"+i).css("display","none");
$(".tag"+i).removeClass("active");
}
$("#news_4").fadeIn();
$("#links_4").fadeIn();
$(this).addClass("active");
return false;
});
var topic1="0px";
var topic2="-948px";
var topic3="-1896px";
var topic_page=1;
$(".topic_prev").addClass("topic_prev_first");
$(document).on("click", ".topic_prev", function() {
if (topic_page !=1){
topic_page-=1;
}else{
}
if (topic_page == 1)
if (topic_page == 1){
$("#topic_list").stop().animate({"left": topic1}, "slow");
if (topic_page == 2)
$(".topic_prev").addClass("topic_prev_first");
}
if (topic_page == 2){
$("#topic_list").stop().animate({"left": topic2}, "slow");
if (topic_page == 3)
$(".topic_prev").removeClass("topic_prev_first");
$(".topic_next").removeClass("topic_next_last");
}
if (topic_page == 3){
$("#topic_list").stop().animate({"left": topic3}, "slow");
$(".topic_prev").removeClass("topic_next_last");
}
});
$(document).on("click", ".topic_next", function() {
@@ -68,12 +29,17 @@ $(document).ready(function(){
topic_page+=1;
}else{
}
if (topic_page == 1)
if (topic_page == 1){
$("#topic_list").stop().animate({"left": topic1}, "slow");
if (topic_page == 2)
$(".topic_prev").addClass("topic_prev_first");
}
if (topic_page == 2){
$("#topic_list").stop().animate({"left": topic2}, "slow");
if (topic_page == 3)
$(".topic_prev").removeClass("topic_prev_first");
}
if (topic_page == 3){
$("#topic_list").stop().animate({"left": topic3}, "slow");
$(".topic_next").addClass("topic_next_last");
}
});
});
@@ -33,18 +33,18 @@ class Panel::Announcement::Widget::BulletinsController < ObitWidgetController
def bulletins_and_web_links
@tags = AnnouncementTag.all
@selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0]
@bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(1) rescue nil
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(1) rescue nil
@bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(5) rescue nil
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
end
def reload_bulletins
@selected_tag = AnnouncementTag.find(params[:tag_id])
@bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(1) rescue nil
@bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(5) rescue nil
end
def reload_web_links
@selected_tag = AnnouncementTag.find(params[:tag_id])
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(1) rescue nil
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
end
@@ -16,11 +16,11 @@
<% @bulletins.each do |post| %>
<tr>
<td><%= post.postdate %></td>
<td><%= post.bulletin_category.i18n_variable[I18n.locale] %></td>
<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post) %>
<%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
</td>
<td><%= post.postdate %></td>
</tr>
<% end %>
@@ -1,7 +1,10 @@
<% @bulletins.each do |bulletin| %>
<li>
<%= bulletin.title[I18n.locale] %>
<%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin) %>
</li>
<% end %>
<%= paginate @bulletins, :params => {:controller => 'widget/bulletins', :action => 'reload_bulletins', :tag_id => @selected_tag.id}, :remote => true %>
<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' %>
</div>
@@ -1,4 +1,3 @@
<li>
<%= link_to tag[I18n.locale], panel_announcement_widget_bulletins_and_web_links_path(:id => tag.id), :remote => true %>
<%= '-' if tag.eql?(@selected_tag) %>
<%= link_to tag[I18n.locale], panel_announcement_widget_bulletins_and_web_links_path(:id => tag.id), :remote => true, :class => ('active' if tag.eql?(@selected_tag)) %>
</li>
@@ -1,7 +1,10 @@
<% @web_links.each do |web_link| %>
<li>
<%= web_link.name[I18n.locale] %>
<a><%= web_link.name[I18n.locale] %></a>
</li>
<% end %>
<%= paginate @web_links, :params => {:controller => 'widget/bulletins', :action => 'reload_web_links', :tag_id => @selected_tag.id}, :remote => true %>
<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' %>
</div>
@@ -1,17 +1,19 @@
<div>
<ul id='bulletins_web_links_tags'>
<div class="tag_block">
<ul id='bulletins_web_links_tags' class="tag_list">
<%= render :partial => 'tag', :collection => @tags %>
</ul>
</div>
<div>
<ul id='bulletins_web_links_bulletins'>
<%= render 'bulletins' %>
<div class="news_block">
<h3 class="news_title2">公告訊息</h3>
<ul id='bulletins_web_links_bulletins' class="news_list">
<%= render 'bulletins' if @bulletins %>
</ul>
</div>
<div>
<ul id='bulletins_web_links_web_links'>
<%= render 'web_links' %>
<div class="links_block">
<h3 class="links_title">相關連結</h3>
<ul id='bulletins_web_links_web_links' class="links_list">
<%= render 'web_links' if @web_links %>
</ul>
</div>
@@ -14,7 +14,7 @@ class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
# @web_link = WebLink.where( :is_hidden => false ).desc(:is_top, :name).first
@web_links = WebLink.widget_datas.limit(5)
@web_links = WebLink.widget_datas.page(params[:page]).per(5)
# get_categorys
@@ -22,6 +22,10 @@ class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
@tags = Tag.all(:conditions => {:module_app_id => module_app.id})
end
def reload_web_links
@web_links = WebLink.widget_datas.page(params[:page]).per(5)
end
protected
@@ -1,18 +1,5 @@
<% # encoding: utf-8 %>
<h3 class="link_title"><%= t('相關連結')%></h3>
<% if @web_links and !@web_links.nil? %>
<% @tags.each_with_index do |tag, index| %>
<div id="links_<%= index %>" class="links_block">
<h3 class="links_title"><%= t('相關連結')%></h3>
<div class="links_prev">prev</div>
<div class="links_next">next</div>
<ul class="links_list">
<%# tag.web_links.each do |post| %>
<% tag.get_visible_links(:name).each do |post| %>
<li><%= link_to post.name[I18n.locale], post.url, {:target => '_blank', :title => post.name[I18n.locale]} %></li>
<% end %>
</ul>
<div id='web_links_links'>
<%= render 'web_links' %>
</div>
<% end %>
<% end %>
+1
View File
@@ -16,6 +16,7 @@ Rails.application.routes.draw do
end
namespace :widget do
match "web_links" => "web_links#index"
match "reload_web_links" => "web_links#reload_web_links"
end
end
end