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 'execjs'
gem 'jquery-rails' gem 'jquery-rails'
gem 'kaminari' gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
gem 'mini_magick' gem 'mini_magick'
gem 'mongoid' 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 GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
specs: specs:
@ -75,10 +84,6 @@ GEM
railties (~> 3.0) railties (~> 3.0)
thor (~> 0.14) thor (~> 0.14)
json (1.6.5) 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) libv8 (3.3.10.4)
linecache19 (0.5.12) linecache19 (0.5.12)
ruby_core_source (>= 0.1.4) ruby_core_source (>= 0.1.4)
@ -216,7 +221,7 @@ DEPENDENCIES
execjs execjs
factory_girl_rails factory_girl_rails
jquery-rails jquery-rails
kaminari kaminari!
mini_magick mini_magick
mongoid mongoid
radius radius

View File

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

View File

@ -275,7 +275,7 @@ a:hover {
} }
p { p {
margin: 0 0 9px; margin: 0 0 9px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: Helvetica, Arial, sans-serif;
font-size: 13px; font-size: 13px;
line-height: 18px; line-height: 18px;
} }
@ -520,7 +520,7 @@ input,
button, button,
select, select,
textarea { textarea {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: Helvetica, Arial, sans-serif;
font-size: 13px; font-size: 13px;
font-weight: normal; font-weight: normal;
line-height: 18px; line-height: 18px;
@ -2459,7 +2459,7 @@ button.btn.small, input[type="submit"].btn.small {
} }
.navbar-search .search-query { .navbar-search .search-query {
padding: 4px 9px; padding: 4px 9px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: Helvetica, Arial, sans-serif;
font-size: 13px; font-size: 13px;
font-weight: normal; font-weight: normal;
line-height: 1; line-height: 1;

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-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-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-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> <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]> <!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]--> <![endif]-->
<%= stylesheet_link_tag "widget" %> <%#= stylesheet_link_tag "module_widget" %>
<%= javascript_include_tag "widget" %> <%= javascript_include_tag "module_widget" %>
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
</head> </head>
<body> <body>

View File

@ -1,66 +1,27 @@
$(document).ready(function(){ $(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 topic1="0px";
var topic2="-948px"; var topic2="-948px";
var topic3="-1896px"; var topic3="-1896px";
var topic_page=1; var topic_page=1;
$(".topic_prev").addClass("topic_prev_first");
$(document).on("click", ".topic_prev", function() { $(document).on("click", ".topic_prev", function() {
if (topic_page !=1){ if (topic_page !=1){
topic_page-=1; topic_page-=1;
}else{ }else{
} }
if (topic_page == 1) if (topic_page == 1){
$("#topic_list").stop().animate({"left": topic1}, "slow"); $("#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"); $("#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_list").stop().animate({"left": topic3}, "slow");
$(".topic_prev").removeClass("topic_next_last");
}
}); });
$(document).on("click", ".topic_next", function() { $(document).on("click", ".topic_next", function() {
@ -68,12 +29,17 @@ $(document).ready(function(){
topic_page+=1; topic_page+=1;
}else{ }else{
} }
if (topic_page == 1) if (topic_page == 1){
$("#topic_list").stop().animate({"left": topic1}, "slow"); $("#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"); $("#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_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 def bulletins_and_web_links
@tags = AnnouncementTag.all @tags = AnnouncementTag.all
@selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0] @selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0]
@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
@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 end
def reload_bulletins def reload_bulletins
@selected_tag = AnnouncementTag.find(params[:tag_id]) @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 end
def reload_web_links def reload_web_links
@selected_tag = AnnouncementTag.find(params[:tag_id]) @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 end

View File

@ -16,11 +16,11 @@
<% @bulletins.each do |post| %> <% @bulletins.each do |post| %>
<tr> <tr>
<td><%= post.postdate %></td>
<td><%= post.bulletin_category.i18n_variable[I18n.locale] %></td> <td><%= post.bulletin_category.i18n_variable[I18n.locale] %></td>
<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post) %> <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) %> <%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
</td> </td>
<td><%= post.postdate %></td>
</tr> </tr>
<% end %> <% end %>

View File

@ -1,7 +1,10 @@
<% @bulletins.each do |bulletin| %> <% @bulletins.each do |bulletin| %>
<li> <li>
<%= bulletin.title[I18n.locale] %> <%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin) %>
</li> </li>
<% end %> <% 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> <li>
<%= link_to tag[I18n.locale], panel_announcement_widget_bulletins_and_web_links_path(:id => tag.id), :remote => true %> <%= 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)) %>
<%= '-' if tag.eql?(@selected_tag) %>
</li> </li>

View File

@ -1,7 +1,10 @@
<% @web_links.each do |web_link| %> <% @web_links.each do |web_link| %>
<li> <li>
<%= web_link.name[I18n.locale] %> <a><%= web_link.name[I18n.locale] %></a>
</li> </li>
<% end %> <% 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> <div class="tag_block">
<ul id='bulletins_web_links_tags'> <ul id='bulletins_web_links_tags' class="tag_list">
<%= render :partial => 'tag', :collection => @tags %> <%= render :partial => 'tag', :collection => @tags %>
</ul> </ul>
</div> </div>
<div> <div class="news_block">
<ul id='bulletins_web_links_bulletins'> <h3 class="news_title2">公告訊息</h3>
<%= render 'bulletins' %> <ul id='bulletins_web_links_bulletins' class="news_list">
<%= render 'bulletins' if @bulletins %>
</ul> </ul>
</div> </div>
<div> <div class="links_block">
<ul id='bulletins_web_links_web_links'> <h3 class="links_title">相關連結</h3>
<%= render 'web_links' %> <ul id='bulletins_web_links_web_links' class="links_list">
<%= render 'web_links' if @web_links %>
</ul> </ul>
</div> </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_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 # get_categorys
@ -23,6 +23,10 @@ class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
end end
def reload_web_links
@web_links = WebLink.widget_datas.page(params[:page]).per(5)
end
protected protected

View File

@ -1,18 +1,5 @@
<% # encoding: utf-8 %> <h3 class="link_title"><%= t('相關連結')%></h3>
<% if @web_links and !@web_links.nil? %> <div id='web_links_links'>
<%= render 'web_links' %>
<% @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> </div>
<% end %>
<% end %>

View File

@ -16,6 +16,7 @@ Rails.application.routes.draw do
end end
namespace :widget do namespace :widget do
match "web_links" => "web_links#index" match "web_links" => "web_links#index"
match "reload_web_links" => "web_links#reload_web_links"
end end
end end
end end