Fix bugs and changes for nccu

This commit is contained in:
Christophe Vilayphiou 2012-02-24 19:11:51 +08:00
parent f8d1d7242d
commit 70b4c83cf5
23 changed files with 100 additions and 456 deletions

View File

@ -20,6 +20,7 @@ gem 'rubyzip'
gem 'sinatra'
gem 'sprockets'
gem 'tinymce-rails'
gem 'therubyracer'
# Gems used only for assets and not required
# in production environments by default.

View File

@ -84,10 +84,7 @@ 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)
mail (2.3.0)
@ -183,6 +180,8 @@ GEM
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
subexec (0.2.1)
therubyracer (0.9.9)
libv8 (~> 3.3.10)
thor (0.14.6)
tilt (1.3.3)
tinymce-rails (3.4.8)
@ -238,6 +237,7 @@ DEPENDENCIES
sinatra
spork
sprockets
therubyracer
tinymce-rails
uglifier
watchr

View File

@ -8,4 +8,3 @@
//= require jquery_ujs
//= require page_edit
//= require side_bar_history
//= require rc

View File

@ -61,7 +61,7 @@ class Admin::PagesController < ApplicationController
def update
@item = Page.find(params[:id])
if @item.module_app.key == 'page_content' && @item.page_contexts.blank?
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
end

View File

@ -14,7 +14,7 @@ class PagesController < ApplicationController
def show
#begin
@item = Item.first(:conditions => {:full_name => params[:page_name]})
if @item.is_published
if @item && @item.is_published
case @item._type
when 'Page'
render_page(params[:id])

View File

@ -11,7 +11,7 @@ module Admin::ItemHelper
end
ret << "<ul class='list'>"
ret << "<li>"
ret << (link_to node.name, dest)
ret << (link_to node.i18n_variable[I18n.locale], dest)
ret << ' | ' << (link_to t('admin.edit'), eval("edit_admin_#{node._type.downcase}_path(node)")) if node._type.eql?('Page')
ret << ' | ' << (link_to t('admin.new_page'), new_admin_page_path(:parent_id => node.id), :class => 'new_page') if node._type.eql?('Page')
ret << ' | ' << (link_to t('admin.new_link'), new_admin_link_path(:parent_id => node.id), :class => 'new_link') if node._type.eql?('Page')

View File

@ -20,7 +20,7 @@ class Design
validates_presence_of :title
validates_presence_of :author
# after_save :parse_css_for_images
after_save :parse_css_for_images
def new_files=(*attrs)
attrs[0].map do |key,items_ary| #Loop by JSs,Themes,Imgs

View File

@ -18,7 +18,7 @@
<td>
<%= design.title %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<ul class="nav nav-pills">
<li><%= link_to t(:edit), edit_admin_design_path(design), :class => 'edit' %></li>
<li class="dropdown"><%= link_to t(:delete), admin_design_path(design), :confirm => t('sure?'), :method => :delete, :class => 'delete' %></li>
</ul>

View File

@ -9,7 +9,7 @@
<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-asset') + t('admin.asset'), admin_assets_path %></li>
<li class="divider"></li>
<li><a href="#"><i class="icons-structure"></i>Structure</a></li>
<li><%= link_to content_tag(:i, nil, :class => 'icons-structure') + t('admin.structure'), admin_items_path %></li>
<li><a href="#"><i class="icons-plus-cube"></i>Add Item</a></li>
</ul>
</div>

View File

@ -13,15 +13,11 @@
<% end -%>
<%= content_tag :li, :class => active_for_controllers('users') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %>
<%= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), panel_web_resource_back_end_web_links_path %>
<% end -%>
<%= content_tag :li, :class => active_for_controllers(nil) do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-page') + t('admin.page'), admin_pages_path %>
<%#= content_tag :ul, :class => "nav nav-list" do -%>
<%#= content_tag :li, link_to(t('admin.all_pages'), panel_page_content_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %>
<%#= content_tag :li, link_to(t('admin.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %>
<%# end -%>
<%= link_to content_tag(:i, nil, :class => 'icons-page') + t('admin.page'), panel_page_content_back_end_page_contexts_path %>
<% end -%>
<%= content_tag :li, :class => active_for_controllers('designs') do -%>

View File

@ -99,7 +99,7 @@ module ParserBackEnd
ret = ''
if (tag.attributes["main"] == "true" && !page.module_app.nil?)
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}?inner=true&page_id=#{page.id}"
ret << "&bulletin_category_id=#{page.category}" if page.category
ret << "&bulletin_category_id=#{page.category}" if page[:category]
ret << "'></div>"
else
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s }

View File

@ -6,7 +6,7 @@ module ParserCommon
if current != 0
res << "<div class='rc_dm'>"
item = rand(100000)
res << "<a href='#{edit ? admin_page_path(page.id) : page.full_name}' class='dm_ctrl' rel='#{item}'>#{page.name}<span class='down'></span></a>"
res << "<a href='#{edit ? admin_page_path(page.id) : page.full_name}' class='dm_ctrl' rel='#{item}'>#{page.i18n_variable[I18n.locale]}<span class='down'></span></a>"
if page.children.size > 0
res << "<div id='#{item}' class='dm_list #{menu.values['class_#{current}']}'>"
res << "<ul class='ini_list'>"
@ -22,7 +22,7 @@ module ParserCommon
res << "</div>"
else
res << '<ul>'
res << "<li>" + "<a href='#{edit ? admin_page_path(page.id) : page.full_name}' class='dm_ctrl'>#{page.name}</a>" + "</li>"
res << "<li>" + "<a href='#{edit ? admin_page_path(page.id) : page.full_name}' class='dm_ctrl'>#{page.i18n_variable[I18n.locale]}</a>" + "</li>"
page.children.each do |child|
res << "<li>" + menu_level(child, current + 1, menu, edit) + "</li>"
end
@ -39,7 +39,7 @@ module ParserCommon
if page.children.size > 0
res << menu_level(page, current + 1, menu, edit)
else
res << "<a href='#{edit ? admin_page_path(page.id) : page.full_name}' class='nav dm_ctrl'>#{page.name}</a>"
res << "<a href='#{edit ? admin_page_path(page.id) : page.full_name}' class='nav dm_ctrl'>#{page.i18n_variable[I18n.locale]}</a>"
end
res << "</li>"
end

View File

@ -126,7 +126,7 @@ module ParserFrontEnd
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}"
ret << "/#{id}" if id
ret << "?inner=true&page_id=#{page.id}"
ret << "&bulletin_category_id=#{page.category}" if page.category
ret << "&bulletin_category_id=#{page.category}" if page[:category]
ret << "'></div>"
else
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } rescue nil

View File

@ -0,0 +1,11 @@
# encoding: utf-8
namespace :add_content do
task :build => :environment do
ModuleApp.new.from_json(File.open("#{Rails.root}/vendor/built_in_modules/page_content/page_content.json").read).save
end
end

View File

@ -12,9 +12,9 @@ class Panel::Announcement::FrontEnd::BulletinsController < ObitWidgetController
date_now = Time.now
if params[:bulletin_category_id]
@bulletins = Bulletin.where(:bulletin_category_id => params[:bulletin_category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(1)
@bulletins = Bulletin.where(:bulletin_category_id => params[:bulletin_category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
else
@bulletins = Bulletin.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(1)
@bulletins = Bulletin.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
end
get_categorys

View File

@ -1,6 +1,8 @@
<% # encoding: utf-8 %>
<!-- <%= f.error_messages %>
<%= f.error_messages %>
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
<div class="field">
<%= f.label :image, t('announcement.image') %><br />
@ -139,392 +141,4 @@
});
});
</script>
<% end %> -->
<!--Widget start-->
<div id="sub-wiget">
<div id="widget-date" class="widget-box">
<div class="widget-action clear">
<a href="#" class="action"><i title="Set the announcement to start and end dates" class="icon-exclamation-sign icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-calendar icons-white"></i> Date</h3>
<div class="widget-content clear">
<div class="control-group">
<label class="control-label">Start</label>
<div class="controls">
<select id="start-day" class="input-small">
<option>Day</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select>
<select id="start-month" class="input-small">
<option>Month</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
<select id="start-year" class="input-small">
<option>Year</option>
<option>2012</option>
<option>2011</option>
<option>2010</option>
<option>2009</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label">End</label>
<div class="controls">
<select id="start-day" class="input-small">
<option>Day</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select>
<select id="start-month" class="input-small">
<option>Month</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
<select id="start-year" class="input-small">
<option>Year</option>
<option>2012</option>
<option>2011</option>
<option>2010</option>
<option>2009</option>
</select>
</div>
</div>
</div>
</div>
<div id="widget-status" class="widget-box">
<div class="widget-action clear">
<a class="action"><i title="Setting the announcement state" class="icon-exclamation-sign icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-star-thin icons-white"></i>Status</h3>
<div class="widget-content clear">
<div class="controls">
<label class="checkbox inline"><input type="checkbox" value="hot">Hot</label>
<label class="checkbox inline"><input type="checkbox" value="top">Top</label>
<label class="checkbox inline"><input type="checkbox" value="hide">Hide</label>
</div>
</div>
</div>
<div id="widget-role" class="widget-box">
<div class="widget-action clear">
<a class="action"><i title="Set the read role" class="icon-exclamation-sign icon-white tip"></i></a>
<a class="action"><i title="Setting" class="icon-cog icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-lock icons-white"></i>Permissions</h3>
<div class="widget-content clear">
<div class="controls">
<label class="radio inline"><input class="privacy" type="radio" value="public" name="privacy">Public</label>
<label class="radio inline"><input class="privacy" type="radio" value="private" name="privacy">Private</label>
<div class="well select-role">
<label class="checkbox inline"><input type="checkbox" value="hot">Student</label>
<label class="checkbox inline"><input type="checkbox" value="top">Teacher</label>
<label class="checkbox inline"><input type="checkbox" value="hide">Staff</label>
</div>
</div>
</div>
</div>
<div id="widget-picture" class="widget-box">
<div class="widget-action clear">
<a class="action"><i title="Upload pictures" class="icon-exclamation-sign icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-picture icons-white"></i>Picture</h3>
<div class="widget-content clear">
<div class="control-group">
<img class="pull-left upload-picture" src="images/default-img.png" />
<div class="controls file-upload">
<label class="control-label btn" for="input-upload">
Browse/選擇檔案
<input id="input-upload" class="upload" type="file" name="upload" onchange="document.getElementById('fu').innerHTML = this.form.fu.value = this.value;">
</label>
<span id='fu' class="file-name"></span>
<br>
<input name='fu' class="input-medium" type="text">
</div>
</div>
</div>
</div>
<div id="widget-tags" class="widget-box">
<div class="widget-action clear">
<a class="action"><i title="Enter post tags, Chinese and English required" class="icon-exclamation-sign icon-white tip"></i></a>
<a class="action"><i title="Setting" class="icon-cog icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag icons-white"></i>Tags</h3>
<div class="widget-content clear form-horizontal">
<div class="control-group error">
<label class="control-label" for="tags-zh-tw">
Chinese
</label>
<div class="controls">
<input id='tags-zh-tw' class="input-prepend" type="text">
<span class="help-inline">Please correct the error</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="tags-en">
English
</label>
<div class="controls">
<input id='tags-en' class="input-prepend" type="text">
<span class="help-inline">Please correct the error</span>
</div>
</div>
<div class="clear">
<a class="pull-right btn btn-primary" href="#">Add/新增</a>
</div>
<hr>
<span class="label label-tags">Default<a href><i class="icon-remove icon-white"></i></a></span>
<span class="label label-tags">Default<a href><i class="icon-remove icon-white"></i></a></span>
<span class="label label-tags">Default<a href><i class="icon-remove icon-white"></i></a></span>
<span class="label label-tags">Default<a href><i class="icon-remove icon-white"></i></a></span>
</div>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<div id="post-body">
<div id="post-body-content" class="clear">
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %> <div class="btn-group pull-right">
<a class="btn dropdown-toggle" href="#" data-toggle="dropdown">
English
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="#">English</a></li>
<li><a href="#">Chinese</a></li>
<li><a href="#">Japanese</a></li>
<li><a href="#">French</a></li>
<li><a href="#">German</a></li>
<!--<li class="divider"></li>
<li><a href="#">Separated link</a></li>-->
</ul>
</div>
<div class="title">
<input class="post-title" type="text" placeholder="Enter title here">
</div>
<div class="editor">
<%= text_area_tag 'locale', nil, :style=>"width:100%" %>
</div>
<div class="main-wiget">
<div id="widget-link" class="widget-box">
<div class="widget-action clear">
<a class="action"><i title="Add a reference link" class="icon-exclamation-sign icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-link icons-white"></i>Link</h3>
<div class="widget-content">
<table class="table table-condensed">
<thead>
<tr>
<th>Chinese</th>
<th>English</th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="3">
<a class="btn btn-primary btn-small" href="#modal-link" data-toggle="modal"><i class="icon-plus icon-white"></i> ADD/新增</a>
</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>…</td>
<td>…</td>
<td><a href="#modal-link" data-toggle="modal" class="action"><i class="icon-pencil"></i></a><a href class="action"><i class="icon-remove"></i></a></td>
</tr>
</tbody>
</table>
</div>
<div id="modal-link" class="modal hide fade">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Add Link / Edit Link</h3>
</div>
<div class="modal-body form-horizontal">
<div class="control-group">
<label for="http" class="control-label">http://</label>
<div class="controls">
<input type="text" value="" id="http" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
<div class="control-group error">
<label for="link-zh-tw" class="control-label">Chinese</label>
<div class="controls">
<input type="text" value="" id="link-zh-tw" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
<div class="control-group">
<label for="link-en" class="control-label">English</label>
<div class="controls">
<input type="text" value="" id="link-en" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-primary" href="#">Submit/確定</a>
<a class="btn" data-dismiss="modal" href="#">Cancel/取消</a>
</div>
</div>
</div>
<div id="widget-file" class="widget-box">
<div class="widget-action clear">
<a class="action"><i title="Added to the file" class="icon-exclamation-sign icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-paperclip icons-white"></i>File</h3>
<div class="widget-content">
<table class="table table-condensed">
<thead>
<tr>
<th>Chinese</th>
<th>English</th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="3">
<a class="btn btn-primary btn-small" href="#modal-file" data-toggle="modal"><i class="icon-plus icon-white"></i> ADD/新增</a>
</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>…</td>
<td>…</td>
<td><a href="#modal-file" data-toggle="modal" class="action"><i class="icon-pencil"></i></a><a href class="action"><i class="icon-remove"></i></a></td>
</tr>
</tbody>
</table>
</div>
<div id="modal-file" class="modal hide fade">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Add File / Edit File</h3>
</div>
<div class="modal-body form-horizontal">
<div class="controls file-upload">
<label class="control-label btn" for="input-upload">
Browse
<input id="input-upload" class="upload" type="file" name="upload" onchange="document.getElementById('fn').innerHTML = this.value;">
</label>
<span id='fn' class="file-name"></span>
</div>
<div class="control-group">
<label for="file-zh-tw" class="control-label">Chinese</label>
<div class="controls">
<input type="text" value="" id="file-zh-tw" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
<div class="control-group">
<label for="file-en" class="control-label">English</label>
<div class="controls">
<input type="text" value="" id="file-en" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-primary" href="#">Submit/確定</a>
<a class="btn" data-dismiss="modal" href="#">Cancel/取消</a>
</div>
</div>
</div>
</div>
</div>
</div>
<!--Post End-->
<div class="form-actions">
<button class="btn btn-success" type="submit">Preview/預覽</button>
<button class="btn btn-primary" type="submit">Submit/送出</button>
<button class="btn" type="reset">Cancel/取消</button>
</div>
<% end %>

View File

@ -2,16 +2,14 @@
<%= flash_messages %>
<%= paginate @bulletins %>
<h1 class="h1"><%= t('bulletin.list_announcement') %></h1>
<table class="table table-bordered">
<tr>
<th><%= t('bulletin.postdate') %></th>
<th><%= t('bulletin.category') %></th>
<th><%= t('bulletin.title') %></th>
<th><%= t('bulletin.postdate') %></th>
</tr>
<% @bulletins.each do |post| %>
@ -27,5 +25,5 @@
</table>
<br />
<%= paginate @bulletins %>

View File

@ -1,9 +1,23 @@
<% # encoding: utf-8 %>
<br />
<br />
<br />
<h1 class="h1"><%= @bulletin.title[I18n.locale] %></h1>
<div class="info">
<div class="info1">
<span class="date"><%= @bulletin.postdate %></span>
&nbsp;|&nbsp;
<a href="" class="unit"><%= User.find(@bulletin.create_user_id).name %></a>
</div>
</div>
<div class="news_image">
<%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %>
<%= link_to image_tag(@bulletin.image.url, :size => "320x240"), @bulletin.image.url, {:target => '_blank', :title => @bulletin.image_identifier} if @bulletin.image.file %>
</div>
<div class="news_paragraph">
<%= @bulletin.text[I18n.locale].html_safe %>
</div>
<div class="fb">
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nccu.edu.tw&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35&amp;appId=263319013700607" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>
</div>
<!--
<p id="notice"><%= flash_messages %></p>
<ul>
@ -25,11 +39,11 @@
</li>
<li>
<b><%= t('announcement.subtitle') %></b>
<%= @bulletin.subtitle[I18n.locale] %>
<%= @bulletin.subtitle[I18n.locale].html_safe %>
</li>
<li>
<b><%= t('announcement.text') %></b>
<%= @bulletin.text[I18n.locale] %>
<%= @bulletin.text[I18n.locale].html_safe %>
</li>
<li>
<li>
@ -52,6 +66,6 @@
<b><%= t('announcement.最後修改時間') %></b>
<%= @bulletin.updated_at.strftime("%Y-%m-%d %H:%I:%S") %>
</li>
-->
<%#= link_back %>

View File

@ -2,7 +2,7 @@
<% if @bulletins and !@bulletins.nil? %>
<h2 class="topic_title"><%= t('焦點新聞')%></h2>
<h2 class="topic_title"><%= t('校園新聞')%></h2>
<%= link_to "more+",panel_announcement_front_end_bulletins_path(), :class => "topic_note" %>
<div class="topic_prev">previous page</div>
<div class="topic_next">next page</div>

View File

@ -3,6 +3,6 @@
<p id="notice"><%= flash_messages %></p>
<h2><%= @page_context.page.i18n_variable[I18n.locale] %></h2>
<h1 class="h1"><%= @page_context.page.i18n_variable[I18n.locale] rescue nil %></h1>
<div class="page_content"><%= @page_context.context[I18n.locale].html_safe %></div>
<div class="page_content"><%= @page_context.context[I18n.locale].html_safe rescue nil %></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.page(params[:page]).per(5)
@web_links = WebLink.widget_datas.page(params[:page]).per(9)
# get_categorys
@ -24,7 +24,7 @@ class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
end
def reload_web_links
@web_links = WebLink.widget_datas.page(params[:page]).per(5)
@web_links = WebLink.widget_datas.page(params[:page]).per(9)
end

View File

@ -0,0 +1,10 @@
<ul>
<% @web_links.each do |widget| -%>
<li><%= link_to widget.name[I18n.locale], widget.url, {:target => '_blank', :title => widget.name[I18n.locale]} %></li>
<% end -%>
</ul>
<div class='pagination'>
<%= link_to_previous_page @web_links, 'Previous Page', :params => {:controller => 'widget/web_links', :action => 'reload_web_links'}, :remote => true, :class => 'previous' %>
<%= link_to_next_page @web_links, 'Next Page', :params => {:controller => 'widget/web_links', :action => 'reload_web_links'}, :remote => true, :class => 'next' %>
</div>

View File

@ -0,0 +1 @@
$('#web_links_links').html("<%= j render 'web_links' if @web_links %>")