Ika's changes

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

View File

@ -9,7 +9,7 @@ gem 'exception_notification' # Send error trace
gem 'execjs'
gem 'jquery-rails'
gem 'kaminari'
gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
gem 'mini_magick'
gem 'mongoid'

View File

@ -1,3 +1,12 @@
GIT
remote: git://github.com/amatsuda/kaminari.git
revision: 118927a42e57d6608c10d85b8a62acfc7c175974
specs:
kaminari (0.13.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
GEM
remote: http://rubygems.org/
specs:
@ -75,10 +84,6 @@ GEM
railties (~> 3.0)
thor (~> 0.14)
json (1.6.5)
kaminari (0.13.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
libv8 (3.3.10.4)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
@ -216,7 +221,7 @@ DEPENDENCIES
execjs
factory_girl_rails
jquery-rails
kaminari
kaminari!
mini_magick
mongoid
radius

View File

@ -2,7 +2,7 @@ $("div.editable").live("mouseenter mouseleave", function (event) {
$(this).children('.edit_link').toggle();
});
$("#page_design_id").live('change', function() {
$("#page_design").live('change', function() {
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_themes');
});

File diff suppressed because it is too large Load Diff

View File

@ -3,5 +3,5 @@
<li><%= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %></li>
<li><%= link_to content_tag(:i, nil, :class => 'icons-page') + t('admin.page'), admin_items_path %></li>
<li><%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %></li>
<li><%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), nil %></li>
<li><%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %></li>
<li><%= link_to content_tag(:i, nil, :class => 'icons-cog') + t('admin.site_settings'), nil %></li>

View File

@ -4,8 +4,8 @@
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<%= stylesheet_link_tag "widget" %>
<%= javascript_include_tag "widget" %>
<%#= stylesheet_link_tag "module_widget" %>
<%= javascript_include_tag "module_widget" %>
<%= csrf_meta_tag %>
</head>
<body>

View File

@ -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");
}
});
});

View File

@ -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

View File

@ -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 %>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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

View File

@ -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 %>

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