From 78a139ff382fc0d0c77296c1890fb94ef0e3b7ea Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 Feb 2012 19:45:48 +0800 Subject: [PATCH] update announcement & web_resource widget --- .../announcement/announcement.json | 2 +- .../widget/bulletins/bulletins_list.html.erb | 12 +++--- .../widget/bulletins/index.html.erb | 28 ++++++------- .../widget/bulletins_controller.rb | 30 ------------- .../widget/web_links_controller.rb | 9 ++-- .../app/models/web_resource_tag.rb | 5 +++ .../widget/bulletins/index.html.erb | 42 ------------------- .../widget/web_links/index.html.erb | 10 +++-- 8 files changed, 39 insertions(+), 99 deletions(-) delete mode 100644 vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/bulletins_controller.rb delete mode 100644 vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/bulletins/index.html.erb diff --git a/vendor/built_in_modules/announcement/announcement.json b/vendor/built_in_modules/announcement/announcement.json index 76516b509..77026d91a 100644 --- a/vendor/built_in_modules/announcement/announcement.json +++ b/vendor/built_in_modules/announcement/announcement.json @@ -7,6 +7,6 @@ "update_info": "Some info", "create_date": "11-11-2011", "app_pages": ["bulletins"], - "widgets": ["bulletins"], + "widgets": ["bulletins","bulletins_list"], "enable_frontend": true } diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_list.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_list.html.erb index e110b5c9c..992049657 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_list.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_list.html.erb @@ -2,7 +2,6 @@ <% if @bulletins and !@bulletins.nil? %> -
- -
-

<%= t('公告訊息')%>

+<% @tags.each_with_index do |tag, index| %> +
+

<%= t('公告訊息')%>

+
prev
+
next
    - <% @bulletins.each do |post| %> + <% tag.bulletins.each do |post| %>
  • <%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post) %>
  • <% end %>
+<% end %> <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb index b6ef35975..8aa261efd 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb @@ -2,21 +2,19 @@ <% if @bulletins and !@bulletins.nil? %> -
-
-

<%= t('焦點新聞')%>

- <%= link_to "more+",panel_announcement_front_end_bulletins_path(), :class => "topic_note" %> -
    - <% @bulletins.each do |post| %> -
  • -
    <%= image_tag(post.image.url, :size => "290x130") if post.image.file %>
    -

    <%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post) %>

    -

    <%= post.subtitle[I18n.locale] %>

    -
  • - <% end %> -
-
-
+

<%= t('焦點新聞')%>

+<%= link_to "more+",panel_announcement_front_end_bulletins_path(), :class => "topic_note" %> +
previous page
+
next page
+ <% end %> diff --git a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/bulletins_controller.rb b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/bulletins_controller.rb deleted file mode 100644 index 5ba9ffc0b..000000000 --- a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/bulletins_controller.rb +++ /dev/null @@ -1,30 +0,0 @@ -class Panel::Announcement::Widget::BulletinsController < ObitWidgetController - - def initialize - super - @app_title = NewBlog::MOUDLEAPP_TITLE - end - - # GET /bulletins - # GET /bulletins.xml - - def index - - # deadline - - @bulletin = Bulletin.where( :postdate.lte => Date.today ).desc(:is_top, :postdate).first - - @bulletins = Bulletin.widget_datas - - get_categorys - - end - - - protected - - def get_categorys - @bulletin_categorys = BulletinCategory.excludes('disabled' => true) - end - -end diff --git a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb index 9bfc0d88c..ac271ea09 100644 --- a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb +++ b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb @@ -12,11 +12,14 @@ class Panel::WebResource::Widget::WebLinksController < ObitWidgetController # deadline - @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 + @web_links = WebLink.widget_datas.limit(5) - get_categorys + # get_categorys + + module_app = ModuleApp.first(:conditions => {:key => 'web_resource'}) + @tags = Tag.all(:conditions => {:module_app_id => module_app.id}) end diff --git a/vendor/built_in_modules/web_resource/app/models/web_resource_tag.rb b/vendor/built_in_modules/web_resource/app/models/web_resource_tag.rb index 85f263b3d..2355cb5e9 100644 --- a/vendor/built_in_modules/web_resource/app/models/web_resource_tag.rb +++ b/vendor/built_in_modules/web_resource/app/models/web_resource_tag.rb @@ -2,4 +2,9 @@ class WebResourceTag < Tag has_and_belongs_to_many :web_links + + def get_visible_links(sort = :name) + self.web_links.where(:is_hidden => false).desc(:is_top, sort) + end + end \ No newline at end of file diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/bulletins/index.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/bulletins/index.html.erb deleted file mode 100644 index 2c4cd1533..000000000 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/bulletins/index.html.erb +++ /dev/null @@ -1,42 +0,0 @@ - - -<% if @bulletin and !@bulletin.nil? %> - -
-

<%= @bulletin.title %>

-

<%= @bulletin.subtitle %>

- <%= link_to "read more >",panel_announcement_front_end_bulletin_path(@bulletin.id) %> - read more > -
- -<% end %> - -<% if @bulletins and !@bulletins.nil? %> - -
-

news

-
    - <% @bulletins.each do |post| %> -
  • <%= post.postdate.to_s.gsub("-", "") %><%= link_to post.title,panel_announcement_front_end_bulletin_path(post) %>
  • - <% end %> -
-<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %> -read more > -
- -
-

news

-
    - <% @bulletins.each do |post| %> -
  • - <%= image_tag(post.image.url, :size => "160x140") if post.image.file %> -

    <%= post.title %>

    - <%= post.subtitle %> -
  • - <% end %> -
-<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %> -read more > -
- -<% end %> diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.html.erb index 265b07101..8b617206f 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.html.erb @@ -2,13 +2,17 @@ <% if @web_links and !@web_links.nil? %> -