Merge branch 'design_team' into dashboard

This commit is contained in:
Christophe Vilayphiou 2012-02-23 16:05:33 +08:00
commit f8d1d7242d
13 changed files with 3425 additions and 3451 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:
@ -213,7 +222,7 @@ DEPENDENCIES
execjs execjs
factory_girl_rails factory_girl_rails
jquery-rails jquery-rails
kaminari kaminari!
mini_magick mini_magick
mongoid mongoid
radius radius

File diff suppressed because it is too large Load Diff

View File

@ -34,4 +34,4 @@
<%= content_tag :li, :class => active_for_controllers(nil) do -%> <%= content_tag :li, :class => active_for_controllers(nil) do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-cog') + t('admin.site_settings'), nil %> <%= link_to content_tag(:i, nil, :class => 'icons-cog') + t('admin.site_settings'), nil %>
<% end -%> <% end -%>

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

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

@ -4,4 +4,7 @@
</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>
<ul id='bulletins_web_links_bulletins' class="news_list">
<%= render 'bulletins' if @bulletins %> <%= 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>
<ul id='bulletins_web_links_web_links' class="links_list">
<%= render 'web_links' if @web_links %> <%= 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
@ -22,6 +22,10 @@ class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}) @tags = Tag.all(:conditions => {:module_app_id => module_app.id})
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