Add module authorization for news

Add files and links to announcement and news
Change page.children into page.ordered_and_visible_children in parser_commom
This commit is contained in:
Christophe Vilayphiou 2012-05-08 10:50:09 +08:00
parent 2aaff21000
commit ba4385e3fd
4 changed files with 26 additions and 105 deletions

View File

@ -27,6 +27,7 @@
<%= content_tag :li, link_to(t('announcement.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => active_for_action('news_bulletin_categorys', 'index') %>
<%= content_tag :li, link_to(t('announcement.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.news_bulletin.approval_setting'), panel_news_back_end_news_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %>
<%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_sys_call_for_app('module_apps','edit','news') if (is_admin? rescue nil) %>
<% end -%>
<% end -%>

View File

@ -3,7 +3,7 @@ module ParserCommon
def menu_level(page, current, menu, edit = false)
res = ''
if page.children.size > 0
if page.ordered_and_visible_children.size > 0
res << "<ul class='"
res << menu.values["class_#{current}"] rescue nil
res << "'>"

View File

@ -14,58 +14,18 @@
<div class="news_paragraph">
<%= @bulletin.text[I18n.locale].html_safe %>
</div>
<b><%= t('announcement.link') %></b>
<% @bulletin.bulletin_links.each do | blink | %>
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
<% end %>
</li>
<li>
<b><%= t('announcement.file') %></b>
<% @bulletin.bulletin_files.each do | bfile | %>
<%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
<% end %>
<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>
<li>
<b><%= t('announcement.category') %></b>
<%= @bulletin.bulletin_category.i18n_variable[I18n.locale] %>
</li>
<li>
<b><%= t('announcement.postdate') %></b>
<%= @bulletin.postdate %>
</li>
<li>
<b><%= t('announcement.title') %></b>
<%= @bulletin.title[I18n.locale] %>
</li>
<li>
<%#= 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 %>
</li>
<li>
<b><%= t('announcement.subtitle') %></b>
<%= @bulletin.subtitle[I18n.locale].html_safe %>
</li>
<li>
<b><%= t('announcement.text') %></b>
<%= @bulletin.text[I18n.locale].html_safe %>
</li>
<li>
<li>
<b><%= t('announcement.link') %></b>
<% @bulletin.bulletin_links.each do | blink | %>
<%= link_to blink.name, blink.url, :target => '_blank' %>
<% end %>
</li>
<li>
<b><%= t('announcement.file') %></b>
<% @bulletin.bulletin_files.each do | bfile | %>
<%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
<% end %>
</li>
<li>
<b><%= t('announcement.張貼者') %></b>
<%= User.find(@bulletin.create_user_id).name %>
</li>
<li>
<b><%= t('announcement.最後修改時間') %></b>
<%= @bulletin.updated_at.strftime("%Y-%m-%d %H:%I:%S") %>
</li>
-->
<%#= link_back %>

View File

@ -14,58 +14,18 @@
<div class="news_paragraph">
<%= @news_bulletin.text[I18n.locale].html_safe %>
</div>
<b><%= t('announcement.link') %></b>
<% @news_bulletin.bulletin_links.each do | blink | %>
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
<% end %>
</li>
<li>
<b><%= t('announcement.file') %></b>
<% @news_bulletin.bulletin_files.each do | bfile | %>
<%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
<% end %>
<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>
<li>
<b><%= t('news.category') %></b>
<%= @news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] %>
</li>
<li>
<b><%= t('news.postdate') %></b>
<%= @news_bulletin.postdate %>
</li>
<li>
<b><%= t('news.title') %></b>
<%= @news_bulletin.title[I18n.locale] %>
</li>
<li>
<%#= image_tag(@news_bulletin.image.url, :size => "320x240") if @news_bulletin.image.file %>
<%= link_to image_tag(@news_bulletin.image.url, :size => "320x240"), @news_bulletin.image.url, {:target => '_blank', :title => @news_bulletin.image_identifier} if @news_bulletin.image.file %>
</li>
<li>
<b><%= t('news.subtitle') %></b>
<%= @news_bulletin.subtitle[I18n.locale].html_safe %>
</li>
<li>
<b><%= t('news.text') %></b>
<%= @news_bulletin.text[I18n.locale].html_safe %>
</li>
<li>
<li>
<b><%= t('news.link') %></b>
<% @news_bulletin.news_bulletin_links.each do | blink | %>
<%= link_to blink.name, blink.url, :target => '_blank' %>
<% end %>
</li>
<li>
<b><%= t('news.file') %></b>
<% @news_bulletin.news_bulletin_files.each do | bfile | %>
<%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
<% end %>
</li>
<li>
<b><%= t('news.張貼者') %></b>
<%= User.find(@news_bulletin.create_user_id).name %>
</li>
<li>
<b><%= t('news.最後修改時間') %></b>
<%= @news_bulletin.updated_at.strftime("%Y-%m-%d %H:%I:%S") %>
</li>
-->
<%#= link_back %>