fix dashboard & announcement

This commit is contained in:
unknown authored and Christophe Vilayphiou committed 2012-03-16 14:44:57 +08:00
1 parent b6d49df145
commit 6f6e84b015
38 files changed
+849 -497

No files matched your search

@@ -1,6 +1,6 @@
class Panel::WebResource::BackEnd::WebLinkCategorysController < ApplicationController
layout 'admin'
layout 'new_admin'
def index
@web_link_categorys = WebLinkCategory.all
@@ -1,7 +1,7 @@
class Panel::WebResource::BackEnd::WebLinksController < ApplicationController
layout 'admin'
layout 'new_admin'
before_filter :authenticate_user!
before_filter :is_admin?
@@ -1,25 +1,29 @@
<% # encoding: utf-8 %>
<%= form_for(@web_link_category, :remote => true, :url => @url) do |f| %>
<%#= form_for(@web_link_category, :remote => true, :url => panel_web_resource_back_end_web_link_category_path(@web_link_category)) do |f| %>
<div class="field">
<%= f.label :key %><br />
<%= f.text_field :key %>
</div>
<h2><%= (@web_link_category.new_record? ? 'Add' : 'Edit') %></h2>
<div id="widget-title">
<%= f.label :key %>
<%= f.text_field :key %>
</div>
<div id="widget-title">
<%= f.fields_for :i18n_variable, (@web_link_category.new_record? ? @web_link_category.build_i18n_variable : @web_link_category.i18n_variable) do |f| %>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'input-xxlarge' %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="field">
<%= f.label :name %><br />
<%= f.fields_for :i18n_variable, (@web_link_category.new_record? ? @web_link_category.build_i18n_variable : @web_link_category.i18n_variable) do |f| %>
<% @site_valid_locales.each do |locale| %>
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
<%= f.text_field locale, :style => "width:130px" %>
<% end %>
<% end %>
</div>
<div class="actions">
<%= f.submit %>
<div class="form-actions">
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
</div>
<% end %>
@@ -1,12 +1,16 @@
<tr id="<%= dom_id web_link_category %>">
<td><%= web_link_category.key %></td>
<% @site_valid_locales.each do |locale| %>
<td><%= web_link_category.i18n_variable[locale] rescue nil %></td>
<% end %>
<td>
<%= link_to t('web_link_category.edit'), edit_panel_web_resource_back_end_web_link_category_path(web_link_category), :remote => true %> |
<%= link_to t('web_link_category.quick_edit'), panel_web_resource_back_end_web_link_category_quick_edit_path(web_link_category), :remote => true %> |
<%= link_to t('web_link_category.delete'), panel_web_resource_back_end_web_link_category_path(web_link_category), :confirm => t('sure?'), :method => :delete, :remote => true %>
</td>
</tr>
<tr id="<%= dom_id web_link_category %>" class="with_action">
<td>
<%= web_link_category.key %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('web_link_category.edit'), edit_panel_web_resource_back_end_web_link_category_path(web_link_category), :remote => true %></li>
<li><%= link_to t('web_link_category.delete'), panel_web_resource_back_end_web_link_category_quick_edit_path(web_link_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
</ul>
</div>
</td>
<% @site_valid_locales.each do |locale| %>
<td><%= web_link_category.i18n_variable[locale] rescue nil %></td>
<% end %>
</tr>
@@ -1,43 +1,23 @@
<% content_for :secondary do %>
<br />
<br />
<br />
<br />
<br />
<ul class="list">
<li><%#= link_to t('web_link_category.new_web_resource_class'), new_panel_web_resource_back_end_web_link_category_path, :class => 'seclink1' %></li>
</ul>
<% end -%>
<%= flash_messages %>
<h1><%= t('web_link_category.list_web_resource_class') %></h1>
<br />
<br />
<br />
<br />
<br />
<table id="web_link_categorys">
<tr>
<th><%= t('web_link_category.key') %></th>
<% @site_valid_locales.each do |locale| %>
<th><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<% end %>
<th><%= t('web_link.action') %></th>
</tr>
<table id="web_link_categorys" class="table main-list">
<thead>
<tr>
<th class="span1-2"><%= t('web_link_category.key') %></th>
<% @site_valid_locales.each do |locale| %>
<th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<% end %>
</tr>
</thead>
<tbody>
<%# @web_link_categorys.each do |post| %>
<%= render :partial => 'web_link_category', :collection => @web_link_categorys %>
<%# end %>
</tbody>
</table>
<br />
<br />
<br />
<br />
<h2>Add New</h2>
<div id="form"><%= render :partial => "form" %></div>
@@ -1,62 +1,101 @@
<% # encoding: utf-8 %>
<%= f.error_messages %>
<%#= debugger %>
<div class="field">
<%= f.label :category %><br />
<%= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %>
</div>
<div class="field">
<%= f.label :name %>
<%= f.fields_for :name, (@web_link.new_record? ? @web_link.build_name : @web_link.name ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale %>
</td>
<% end %>
<% end %>
</div>
<div class="field">
<%= f.label :url %><br />
<%= f.text_field :url, :size => 60 %>
</div>
<div class="field">
<%= f.label :describe %>
<%= f.fields_for :context, (@web_link.new_record? ? @web_link.build_context : @web_link.context ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :rows => 10, :cols => 40 %>
</td>
<% end %>
<% end %>
</div>
<!--Widget start-->
<div id="sub-wiget">
<div id="widget-status" class="widget-box widget-size-300">
<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">
<%= f.check_box :is_top %><%= t('top') %>
<%= f.check_box :is_hot %><%= t('hot') %>
<%= f.check_box :is_hidden %><%= t('hide') %>
</div>
</div>
</div>
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear">
<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">
<% @tags.each do |tag| %>
<%= check_box_tag 'web_link[tag_ids][]', tag.id, @web_link.tag_ids.include?(tag.id)%>
<%= tag[I18n.locale] %>
<% end %>
</div>
</div>
<div class="field">
<%= f.label :status %><br />
<%= f.check_box :is_top %><%= t('top') %>
<%= f.check_box :is_hot %><%= t('hot') %>
<%= f.check_box :is_hidden %><%= t('hidden') %>
</div>
<div class="field">
<%= f.label :tags %><br />
<% @tags.each do |tag| %>
<%= check_box_tag 'web_link[tag_ids][]', tag.id, @web_link.tag_ids.include?(tag.id)%>
<%= tag[I18n.locale] %>
<% end %>
</div>
<br />
<br />
</div>
<div class="actions">
<%= f.submit %>
<!--Wiget End-->
<!--Post Start-->
<div id="post-body">
<div id="post-body-content" class="clear">
<%= f.label :category %>
<%= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %>
<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">
<%= f.label :name %>
<%= f.fields_for :name, (@web_link.new_record? ? @web_link.build_name : @web_link.name ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title' %>
</td>
<% end %>
<% end %>
</div>
<div class="title">
<%= f.label :url %>
<%= f.text_field :url %>
</div>
<div class="title">
<%= f.label :describe %>
<%= f.fields_for :context, (@web_link.new_record? ? @web_link.build_context : @web_link.context ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :style=>"width:100%" %>
</td>
<% end %>
<% end %>
</div>
</div>
<!--Post End-->
<div class="form-actions">
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
</div>
@@ -1,5 +1,5 @@
<tr id="<%= dom_id post %>">
<tr id="<%= dom_id post %>" class="with_action">
<td>
<% if post.is_top? %>
<span class="label label-success"><%= t(:top) %></span>
@@ -10,6 +10,12 @@
<% if post.is_hidden? %>
<span class="label"><%= t(:hidden) %></span>
<% end %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('web_link.edit'), edit_panel_web_resource_back_end_web_link_path(post) %></li>
<li><%= link_to t('web_link.delete'), panel_web_resource_back_end_web_link_path(post), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
</ul>
</div>
</td>
<td><%= post.web_link_category.i18n_variable[I18n.locale] %></td>
<td>
@@ -20,12 +26,5 @@
<span class="label label-tags"><%= tag[I18n.locale] %></span>
<% end %>
</td>
<td>
<%= link_to t('web_link.edit'), edit_panel_web_resource_back_end_web_link_path(post) %> |
<%= link_to t(:set_top), eval("panel_web_resource_back_end_web_link_path(post, :authenticity_token => form_authenticity_token, :web_link => {:is_top => true})"), :remote => true, :method => :put, :id => "disable_#{post.id}", :style => "display:#{post.is_top? ? 'none' : ''}", :class => 'switch' %>
<%= link_to t(:cancel_top), eval("panel_web_resource_back_end_web_link_path(post, :authenticity_token => form_authenticity_token, :web_link => {:is_top => false})"), :remote => true, :method => :put, :id => "enable_#{post.id}", :style => "display:#{post.is_top? ? '' : 'none'}", :class => 'switch' %>
| <%= link_to t('web_link.delete'), panel_web_resource_back_end_web_link_path(post), :confirm => t('sure?'), :method => :delete, :remote => true %>
</td>
</tr>
@@ -1,52 +1,21 @@
<% content_for :secondary do %>
<br />
<br />
<br />
<br />
<br />
<ul class="list">
<li><%= link_to t('web_link.new_link'), new_panel_web_resource_back_end_web_link_path %></li>
<li><%= link_to t('web_link.link_list'), panel_web_resource_back_end_web_links_path %></li>
<li><%= link_to t('web_link.new_link_class'), panel_web_resource_back_end_web_link_categorys_path %></li>
</ul>
<% end -%>
<%= flash_messages %>
<br />
<br />
<br />
<br />
<br />
<%= form_for :web_link, :action => 'search', :method => 'get', :url => panel_web_resource_back_end_web_links_path do |f| %>
<%#= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ] },{ :include_blank => t('web_link.select') }%>
Category <%= select_tag "category_id", options_for_select(@web_link_categorys.collect{|t| [t.i18n_variable[I18n.locale], t.id]}), :prompt => t('web_link.select') %>
<%= submit_tag "OK", :name => nil %>
<% end %>
<br />
<br />
<h1><%= t('web_link.list_link') %></h1>
<table>
<tr>
<th><%= t('web_link.status') %></th>
<th><%= t('web_link.category') %></th>
<th><%= t('web_link.name') %></th>
<th><%= t('web_link.tags') %></th>
<th><%= t('web_link.action') %></th>
</tr>
<table class="table main-list">
<thead>
<tr>
<th class="span1-2"><%= t('web_link.status') %></th>
<th class="span1-2"><%= t('web_link.category') %></th>
<th class="span1-2"><%= t('web_link.name') %></th>
<th class="span1-2"><%= t('web_link.tags') %></th>
</tr>
</thead>
<tbody>
<% @web_links.each do |post| %>
<%= render :partial => 'web_links', :locals => {:post => post} %>
<% end %>
</table>
<br />
<% end %>
</tbody>
</table>