Announcement modifications and tags
This commit is contained in:
parent
f57e9f19f7
commit
3e70634add
|
@ -16,7 +16,7 @@ $(document).ready(function(){
|
|||
|
||||
$(function() {
|
||||
var $role = $('.select-role');
|
||||
$('[name="privacy"]').each(function($i) {
|
||||
$('.privacy').each(function($i) {
|
||||
$(this).click(function() {
|
||||
switch ($i) {
|
||||
case 0:
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
class Admin::TagsController < ApplicationController
|
||||
|
||||
layout 'new_admin'
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
before_filter :set_module_app
|
||||
|
||||
def index
|
||||
get_tags
|
||||
@module_app_id = @module_app.id rescue nil
|
||||
end
|
||||
|
||||
def new
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
@tag = Tag.find(params[:id])
|
||||
end
|
||||
|
||||
def create
|
||||
@tag = Tag.create(params[:tag])
|
||||
end
|
||||
|
||||
def update
|
||||
@tag = Tag.find(params[:id])
|
||||
@tag.update_attributes(params[:tag])
|
||||
end
|
||||
|
||||
def destroy
|
||||
@tag = Tag.find(params[:id])
|
||||
@tag.destroy
|
||||
respond_to do |format|
|
||||
format.js { render 'js/remove_element', :locals => {:id => "#{dom_id @tag}"} }
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_module_app
|
||||
@module_app ||= ModuleApp.first(:conditions => {:key => @app_title.underscore}) rescue nil
|
||||
end
|
||||
|
||||
def get_tags
|
||||
@tags = (@module_app ? @module_app.tags : Tag.all)
|
||||
end
|
||||
|
||||
end
|
|
@ -17,4 +17,8 @@ class I18nVariable
|
|||
end
|
||||
end
|
||||
|
||||
def self.from_locale(locale)
|
||||
I18nVariable.first(:conditions => {:key => locale})[I18n.locale]
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -18,6 +18,8 @@ class ModuleApp
|
|||
has_many :managers,as: :managing_app ,:class_name => "AppManager" #,:dependent => :destroy,:foreign_key => "managing_app_id",:inverse_of => :managing_app
|
||||
has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager"#, :dependent => :destroy,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app
|
||||
|
||||
has_many :tags
|
||||
|
||||
has_one :app_auth,dependent: :delete
|
||||
|
||||
before_save :set_key
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class Tag
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
belongs_to :module_app
|
||||
has_and_belongs_to_many :bulletins
|
||||
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
<%= form_for :tag, :url => admin_tags_path, :remote => true, :html => {:id => 'tag_form'} do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<%= I18nVariable.from_locale(locale) %>:<%= f.text_field locale %>
|
||||
<% end %>
|
||||
<%= f.hidden_field :module_app_id, :value => @module_app_id %>
|
||||
<%= f.submit %>
|
||||
<% end %>
|
|
@ -0,0 +1,7 @@
|
|||
<%= form_for tag, :url => admin_tag_path(tag), :remote => true do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<%= I18nVariable.from_locale(locale) %>:<%= f.text_field locale %>
|
||||
<% end %>
|
||||
<%= f.hidden_field :module_app_id, :value => tag.module_app_id %>
|
||||
<%= f.submit %>
|
||||
<% end %>
|
|
@ -0,0 +1,8 @@
|
|||
<div id="<%= dom_id tag %>" >
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<%= I18nVariable.from_locale(locale) %>:
|
||||
<%= tag[locale] %>
|
||||
<% end %>
|
||||
<%= link_to t(:edit), edit_admin_tag_path(tag), :remote => true %>
|
||||
<%= link_to t(:delete), admin_tag_path(tag), :confirm => t('sure?'), :method => :delete, :remote => true %>
|
||||
</div>
|
|
@ -0,0 +1,4 @@
|
|||
$('#tag_form').each(function(){
|
||||
this.reset();
|
||||
});
|
||||
$('#tags').append("<%= j render :partial => 'tag', :object => @tag %>")
|
|
@ -0,0 +1 @@
|
|||
$('#<%= dom_id @tag %>').html("<%= j render :partial => 'form', :locals => {:tag => @tag} %>")
|
|
@ -0,0 +1,6 @@
|
|||
<div id='tags'>
|
||||
<%= render :partial => 'tag', :collection => @tags %>
|
||||
</div>
|
||||
-------------------------
|
||||
<br/>
|
||||
<%= render 'add' %>
|
|
@ -0,0 +1 @@
|
|||
$('#<%= dom_id @tag %>').html("<%= j render :partial => 'tag', :object => @tag %>")
|
|
@ -0,0 +1,11 @@
|
|||
<%# Link to the "First" page
|
||||
- available local variables
|
||||
url: url to the first page
|
||||
current_page: a page object for the currently displayed page
|
||||
num_pages: total number of pages
|
||||
per_page: number of items to fetch per page
|
||||
remote: data-remote
|
||||
-%>
|
||||
<span class="first">
|
||||
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %>
|
||||
</span>
|
|
@ -0,0 +1,8 @@
|
|||
<%# Non-link tag that stands for skipped pages...
|
||||
- available local variables
|
||||
current_page: a page object for the currently displayed page
|
||||
num_pages: total number of pages
|
||||
per_page: number of items to fetch per page
|
||||
remote: data-remote
|
||||
-%>
|
||||
<span class="page gap"><%= raw(t 'views.pagination.truncate') %></span>
|
|
@ -0,0 +1,11 @@
|
|||
<%# Link to the "Last" page
|
||||
- available local variables
|
||||
url: url to the last page
|
||||
current_page: a page object for the currently displayed page
|
||||
num_pages: total number of pages
|
||||
per_page: number of items to fetch per page
|
||||
remote: data-remote
|
||||
-%>
|
||||
<span class="last">
|
||||
<%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
|
||||
</span>
|
|
@ -0,0 +1,11 @@
|
|||
<%# Link to the "Next" page
|
||||
- available local variables
|
||||
url: url to the next page
|
||||
current_page: a page object for the currently displayed page
|
||||
num_pages: total number of pages
|
||||
per_page: number of items to fetch per page
|
||||
remote: data-remote
|
||||
-%>
|
||||
<span class="next">
|
||||
<%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %>
|
||||
</span>
|
|
@ -0,0 +1,12 @@
|
|||
<%# Link showing page number
|
||||
- available local variables
|
||||
page: a page object for "this" page
|
||||
url: url to this page
|
||||
current_page: a page object for the currently displayed page
|
||||
num_pages: total number of pages
|
||||
per_page: number of items to fetch per page
|
||||
remote: data-remote
|
||||
-%>
|
||||
<span class="page<%= ' current' if page.current? %>">
|
||||
<%= link_to_unless page.current?, page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
|
||||
</span>
|
|
@ -0,0 +1,23 @@
|
|||
<%# The container tag
|
||||
- available local variables
|
||||
current_page: a page object for the currently displayed page
|
||||
num_pages: total number of pages
|
||||
per_page: number of items to fetch per page
|
||||
remote: data-remote
|
||||
paginator: the paginator that renders the pagination tags inside
|
||||
-%>
|
||||
<%= paginator.render do -%>
|
||||
<nav class="pagination">
|
||||
<%= first_page_tag unless current_page.first? %>
|
||||
<%= prev_page_tag unless current_page.first? %>
|
||||
<% each_page do |page| -%>
|
||||
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
|
||||
<%= page_tag page %>
|
||||
<% elsif !page.was_truncated? -%>
|
||||
<%= gap_tag %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<%= next_page_tag unless current_page.last? %>
|
||||
<%= last_page_tag unless current_page.last? %>
|
||||
</nav>
|
||||
<% end -%>
|
|
@ -0,0 +1,11 @@
|
|||
<%# Link to the "Previous" page
|
||||
- available local variables
|
||||
url: url to the previous page
|
||||
current_page: a page object for the currently displayed page
|
||||
num_pages: total number of pages
|
||||
per_page: number of items to fetch per page
|
||||
remote: data-remote
|
||||
-%>
|
||||
<span class="prev">
|
||||
<%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %>
|
||||
</span>
|
|
@ -9,6 +9,7 @@ en:
|
|||
|
||||
add: Add
|
||||
back: Back
|
||||
cancel: Cancel
|
||||
create: Create
|
||||
delete: Delete
|
||||
disable: Disable
|
||||
|
@ -24,6 +25,7 @@ en:
|
|||
nothing: Nothing
|
||||
password: Password
|
||||
show: Show
|
||||
submit: Submit
|
||||
sure?: Are you sure?
|
||||
update: Update
|
||||
yes_: "Yes"
|
||||
|
@ -31,6 +33,7 @@ en:
|
|||
admin:
|
||||
action: Action
|
||||
ad_banner: AD Banner
|
||||
add: Add
|
||||
add_language: Add language
|
||||
add_drop_down_item: +Add Menu Item
|
||||
admin: Admin
|
||||
|
|
|
@ -81,6 +81,7 @@ PrototypeR4::Application.routes.draw do
|
|||
end
|
||||
resources :sites
|
||||
resources :snippets
|
||||
resources :tags
|
||||
resources :translations
|
||||
resources :users
|
||||
end
|
||||
|
|
|
@ -8,11 +8,15 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController
|
|||
def index
|
||||
# @bulletins = Bulletin.all
|
||||
# @bulletins = Bulletin.desc("postdate desc")
|
||||
get_categorys(params[:bulletin_category_id])
|
||||
get_categorys(params[:bulletin_category_id])
|
||||
|
||||
# @bulletins = Bulletin.where("bulletin_category_id" => params[:bulletin_category_id]).desc("postdate") if params[:bulletin_category_id]
|
||||
|
||||
@bulletins = Bulletin.search(params[:search],params[:category_id])
|
||||
@bulletins = Bulletin.search(params[:search],params[:category_id])
|
||||
@bulletin_categories = BulletinCategory.all
|
||||
|
||||
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
|
||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id})
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
class Panel::Announcement::BackEnd::TagsController < Admin::TagsController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'announcement'
|
||||
end
|
||||
|
||||
end
|
|
@ -8,6 +8,7 @@ class Bulletin
|
|||
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :subtitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :text, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_and_belongs_to_many :tags
|
||||
|
||||
field :postdate , :type => Date
|
||||
field :deadline , :type => Date
|
||||
|
@ -19,6 +20,8 @@ class Bulletin
|
|||
field :is_hot, :type => Boolean, :default => false
|
||||
field :is_hidden, :type => Boolean, :default => false
|
||||
|
||||
field :public, :type => Boolean, :default => true
|
||||
|
||||
mount_uploader :image, ImageUploader
|
||||
|
||||
belongs_to :bulletin_category
|
||||
|
@ -30,9 +33,6 @@ class Bulletin
|
|||
|
||||
accepts_nested_attributes_for :bulletin_files, :allow_destroy => true
|
||||
accepts_nested_attributes_for :bulletin_links, :allow_destroy => true
|
||||
accepts_nested_attributes_for :title, :allow_destroy => true
|
||||
accepts_nested_attributes_for :subtitle, :allow_destroy => true
|
||||
accepts_nested_attributes_for :text, :allow_destroy => true
|
||||
|
||||
validates_presence_of :title
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
class BulletinImage < BulletinFile
|
||||
|
||||
field :name
|
||||
|
||||
embedded_in :bulletin
|
||||
|
||||
mount_uploader :file, ImageUploader
|
||||
|
||||
end
|
|
@ -0,0 +1,48 @@
|
|||
<tr id="<%= dom_id bulletin %>">
|
||||
<td><input type="checkbox"></td>
|
||||
<td>
|
||||
<% if bulletin.is_top? %>
|
||||
<span class="label label-success"><%= t(:top) %></span>
|
||||
<% end %>
|
||||
<% if bulletin.is_hot? %>
|
||||
<span class="label label-important"><%= t(:hot) %></span>
|
||||
<% end %>
|
||||
<% if bulletin.is_hidden? %>
|
||||
<span class="label"><%= t(:hidden) %></span>
|
||||
<% end %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle">Quick Edit<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu" id="menu1">
|
||||
<li><a href="#">Basic</a></li>
|
||||
<li><a href="#">Picture</a></li>
|
||||
<li><a href="#">Tags</a></li>
|
||||
<li><a href="#">Link</a></li>
|
||||
<li><a href="#">File</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= bulletin.bulletin_category.i18n_variable[I18n.locale] %></td>
|
||||
<td><%= link_to bulletin.title[I18n.locale], panel_announcement_back_end_bulletin_path(bulletin) %></td>
|
||||
<td><%= bulletin.postdate %></td>
|
||||
<td><%= (bulletin.deadline) ? bulletin.deadline : t('bulletin.no_deadline') %></td>
|
||||
<td>
|
||||
<% bulletin.tags.each do |tag| %>
|
||||
<span class="label label-tags"><%= tag[I18n.locale] %></span>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>rulingcom</td>
|
||||
</tr>
|
||||
|
||||
<%= render :partial => 'quick_edit', :locals => {:bulletin => bulletin} %>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
<% end %>
|
|
@ -1,18 +0,0 @@
|
|||
|
||||
<tr id="<%= dom_id post %>">
|
||||
<td></td>
|
||||
<td><%= post.bulletin_category.i18n_variable[I18n.locale] %></td>
|
||||
<td><%#= link_to post.title, panel_announcement_front_end_bulletin_path(post) %>
|
||||
<%= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
|
||||
</td>
|
||||
<td><%= post.postdate %></td>
|
||||
<td><%= (post.deadline) ? post.deadline : t('bulletin.no_deadline') %></td>
|
||||
<td>
|
||||
<%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(post) %> |
|
||||
|
||||
<%= link_to t(:set_top), eval("panel_announcement_back_end_bulletin_path(post, :authenticity_token => form_authenticity_token, :bulletin => {: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_announcement_back_end_bulletin_path(post, :authenticity_token => form_authenticity_token, :bulletin => {:is_top => false})"), :remote => true, :method => :put, :id => "enable_#{post.id}", :style => "display:#{post.is_top? ? '' : 'none'}", :class => 'switch' %>
|
||||
|
||||
| <%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(post), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %>
|
||||
</td>
|
||||
</tr>
|
|
@ -0,0 +1,56 @@
|
|||
<div class="subnav">
|
||||
<ul class="nav nav-pills filter">
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-status" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><%= t(:status) %> <b class="web-symbol"></b></a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-category" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><%= t(:category) %> <b class="web-symbol"></b></a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-tags" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><%= t(:tags) %> <b class="web-symbol"></b></a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="filters">
|
||||
<div class="accordion-body collapse" id="collapse-status">
|
||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<a href="#" class="btn">Category1</a>
|
||||
<a href="#" class="btn">Category2</a>
|
||||
</div>
|
||||
<div class="filter-clear">
|
||||
<a href="#" class="btn"><i class="icons-brush-large"></i>Clear/重置</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="accordion-body collapse" id="collapse-category">
|
||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<a href="#" class="btn">Category1</a>
|
||||
<a href="#" class="btn">Category2</a>
|
||||
</div>
|
||||
<div class="filter-clear">
|
||||
<a href="#" class="btn"><i class="icons-brush-large"></i>Clear/重置</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="accordion-body collapse" id="collapse-tags">
|
||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<a href="#" class="btn">Tag1</a>
|
||||
<a href="#" class="btn">Tag2</a>
|
||||
<a href="#" class="btn">Tag3</a>
|
||||
<a href="#" class="btn">Tag4</a>
|
||||
<a href="#" class="btn">Tag5</a>
|
||||
<a href="#" class="btn">Tag6</a>
|
||||
<a href="#" class="btn">Tag7</a>
|
||||
<a href="#" class="btn">Tag8</a>
|
||||
<a href="#" class="btn">Tag9</a>
|
||||
<a href="#" class="btn">Tag10</a>
|
||||
</div>
|
||||
<div class="filter-clear">
|
||||
<a href="#" class="btn"><i class="icons-brush-large"></i>Clear/重置</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -20,7 +20,10 @@
|
|||
<%= f.label :title %>
|
||||
<%= f.fields_for :title, (@bulletin.new_record? ? @bulletin.build_title : @bulletin.title ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= f.text_field locale %></td>
|
||||
<td>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -29,7 +32,10 @@
|
|||
<%= f.label :subtitle %>
|
||||
<%= f.fields_for :subtitle, (@bulletin.new_record? ? @bulletin.build_subtitle : @bulletin.subtitle ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= f.text_area locale, :rows => 10, :cols => 40 %></td>
|
||||
<td>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :rows => 10, :cols => 40 %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -38,7 +44,10 @@
|
|||
<%= f.label :text %>
|
||||
<%= f.fields_for :text, (@bulletin.new_record? ? @bulletin.build_text : @bulletin.text ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= f.text_area locale, :rows => 10, :cols => 40 %></td>
|
||||
<td>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :rows => 10, :cols => 40 %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<!-- <tr class="qe-block hide"> -->
|
||||
<tr class="qe-block">
|
||||
<td colspan="8">
|
||||
<legend>Quick Edit - Basic / Picture / Tags / Link / File</legend>
|
||||
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_path(bulletin), :html => {:class => 'form-horizontal'} do |f| %>
|
||||
<%= render :partial => "quick_edit_basic", :locals => { :f => f, :bulletin => bulletin } %>
|
||||
<%= render :partial => "quick_edit_picture", :locals => { :f => f, :bulletin => bulletin } %>
|
||||
<%#= render :partial => "quick_edit_links", :locals => { :f => f, :bulletin => bulletin } %>
|
||||
<%= render :partial => "quick_edit_tags", :locals => { :f => f, :bulletin => bulletin } %>
|
||||
<div class="form-actions">
|
||||
<%= f.submit t(:submit), :class => 'btn btn-primary' %>
|
||||
<%= f.submit t(:cancel), :class => 'btn', :type => 'reset' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
|
@ -0,0 +1,62 @@
|
|||
<div id="qe-basic">
|
||||
<div id="widget-category">
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:category) %></label>
|
||||
<div class="controls">
|
||||
<%= f.select :bulletin_category_id, @bulletin_categories.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => 'input-large' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.fields_for :title, bulletin.title do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge' %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="widget-date">
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:start) %></label>
|
||||
<div class="controls">
|
||||
<%= f.date_select :postdate, {}, :class => 'input-small' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:end) %></label>
|
||||
<div class="controls">
|
||||
<%= f.date_select :deadline, {}, :class => 'input-small' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="widget-status">
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:status) %></label>
|
||||
<div class="controls">
|
||||
<label class="checkbox inline"><%= f.check_box :is_hot %><%= t(:hot) %></label>
|
||||
<label class="checkbox inline"><%= f.check_box :is_top %><%= t(:top) %></label>
|
||||
<label class="checkbox inline"><%= f.check_box :is_hidden %><%= t(:hidden) %></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="widget-role">
|
||||
<div class="control-group">
|
||||
<label class="control-label">Role</label>
|
||||
<div class="controls">
|
||||
<label class="radio inline"><%= f.radio_button :public, true, :class => 'privacy' %>Public</label>
|
||||
<label class="radio inline"><%= f.radio_button :public, false, :class => 'privacy' %>Private</label>
|
||||
<div class="well select-role" style="display:<%= bulletin.public ? 'none' : 'block' %>;">
|
||||
<label class="checkbox inline"><input type="checkbox" value="student">Student</label>
|
||||
<label class="checkbox inline"><input type="checkbox" value="teacher">Teacher</label>
|
||||
<label class="checkbox inline"><input type="checkbox" value="staff">Staff</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,62 @@
|
|||
<div id="qe-file">
|
||||
<div id="widget-file">
|
||||
<div class="control-group">
|
||||
<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>
|
|
@ -0,0 +1,62 @@
|
|||
<div id="qe-link">
|
||||
<div id="widget-link">
|
||||
<div class="control-group">
|
||||
<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>
|
|
@ -0,0 +1,19 @@
|
|||
<div id="qe-picture">
|
||||
<div id="widget-picture">
|
||||
<div class="control-group">
|
||||
<label class="control-label">Picture</label>
|
||||
<div class="control-group">
|
||||
<img class="pull-left upload-picture" src="img/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-large" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,44 @@
|
|||
<!-- <div id="qe-tags">
|
||||
<div id="widget-tags">
|
||||
<div class="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="control-group">
|
||||
<div class="controls">
|
||||
<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>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div id="qe-tags">
|
||||
<div id="widget-tags">
|
||||
<div class="form-horizontal">
|
||||
<% @tags.each do |tag| %>
|
||||
<%= check_box_tag 'bulletin[tag_ids][]', tag.id, bulletin.tag_ids.include?(tag.id)%>
|
||||
<%= tag[I18n.locale] %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -39,95 +39,33 @@
|
|||
<br />
|
||||
<br />
|
||||
|
||||
<h1><%= t('bulletin.list_announcement') %></h1>
|
||||
|
||||
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('bulletin.status') %></th>
|
||||
<th><%= t('bulletin.category') %></th>
|
||||
<th><%= t('bulletin.title') %></th>
|
||||
<th><%= t('bulletin.postdate') %></th>
|
||||
<th><%= t('bulletin.deadline') %></th>
|
||||
<th><%= t('bulletin.action') %></th>
|
||||
</tr>
|
||||
|
||||
<% @bulletins.each do |post| %>
|
||||
<%= render :partial => 'bulletins', :locals => {:post => post} %>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
-->
|
||||
|
||||
<%= render 'filter' %>
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1 strong">
|
||||
<input type="checkbox">
|
||||
<a href class="list-remove"><i class="icon-trash"></i></a>
|
||||
</th>
|
||||
<th class="span1"><%= t('bulletin.status') %></th>
|
||||
<th class="span1-2"><%= t('bulletin.category') %></th>
|
||||
<th class="span7 select"><%= t('bulletin.title') %></th>
|
||||
<th class="span1-2"><%= t('bulletin.start_date') %></th>
|
||||
<th class="span1-2"><%= t('bulletin.end_date') %></th>
|
||||
<th class="span1-2"><%= t('bulletin.tags') %></th>
|
||||
<th class="span1-2"><%= t('bulletin.last_modified') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%= render :partial => 'bulletin', :collection => @bulletins %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<div class="subnav">
|
||||
<ul class="nav nav-pills filter">
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-status" data-toggle="collapse" data-parent=".filters" class="accordion-toggle">Status <b class="web-symbol"></b></a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-category" data-toggle="collapse" data-parent=".filters" class="accordion-toggle">Category <b class="web-symbol"></b></a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-tags" data-toggle="collapse" data-parent=".filters" class="accordion-toggle">Tags <b class="web-symbol"></b></a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="filters">
|
||||
<div class="accordion-body collapse" id="collapse-status">
|
||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<a href="#" class="btn">Category1</a>
|
||||
<a href="#" class="btn">Category2</a>
|
||||
</div>
|
||||
<div class="filter-clear">
|
||||
<a href="#" class="btn"><i class="icons-brush-large"></i>Clear/重置</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="accordion-body collapse" id="collapse-category">
|
||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<a href="#" class="btn">Category1</a>
|
||||
<a href="#" class="btn">Category2</a>
|
||||
</div>
|
||||
<div class="filter-clear">
|
||||
<a href="#" class="btn"><i class="icons-brush-large"></i>Clear/重置</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="accordion-body collapse" id="collapse-tags">
|
||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<a href="#" class="btn">Tag1</a>
|
||||
<a href="#" class="btn">Tag2</a>
|
||||
<a href="#" class="btn">Tag3</a>
|
||||
<a href="#" class="btn">Tag4</a>
|
||||
<a href="#" class="btn">Tag5</a>
|
||||
<a href="#" class="btn">Tag6</a>
|
||||
<a href="#" class="btn">Tag7</a>
|
||||
<a href="#" class="btn">Tag8</a>
|
||||
<a href="#" class="btn">Tag9</a>
|
||||
<a href="#" class="btn">Tag10</a>
|
||||
<a href="#" class="btn">Tag11</a>
|
||||
<a href="#" class="btn">Tag12</a>
|
||||
<a href="#" class="btn">Tag13</a>
|
||||
<a href="#" class="btn">Tag14</a>
|
||||
<a href="#" class="btn">Tag15</a>
|
||||
<a href="#" class="btn">Tag16</a>
|
||||
<a href="#" class="btn">Tag17</a>
|
||||
<a href="#" class="btn">Tag18</a>
|
||||
<a href="#" class="btn">Tag19</a>
|
||||
<a href="#" class="btn">Tag20</a>
|
||||
</div>
|
||||
<div class="filter-clear">
|
||||
<a href="#" class="btn"><i class="icons-brush-large"></i>Clear/重置</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,24 +1,6 @@
|
|||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<% content_for :secondary do %>
|
||||
<ul class="list">
|
||||
<li><%= link_to t('bulletin.index'), panel_announcement_back_end_bulletins_path, :class => 'seclink2' %></li>
|
||||
</ul>
|
||||
<% end -%>
|
||||
|
||||
<%= flash_messages %>
|
||||
<h1><%= t('bulletin.new_announcement') %></h1>
|
||||
<%= form_for @bulletin, :url => panel_announcement_back_end_bulletins_path do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
|
||||
<%= link_back %>
|
||||
|
||||
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<%= link_back %>
|
|
@ -5,9 +5,10 @@ Rails.application.routes.draw do
|
|||
namespace :back_end do
|
||||
root :to => "bulletins#index"
|
||||
resources :bulletins
|
||||
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
|
||||
match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit
|
||||
end
|
||||
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
|
||||
match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit
|
||||
end
|
||||
resources :tags
|
||||
end
|
||||
namespace :front_end do
|
||||
root :to => "bulletins#index"
|
||||
|
|
Reference in New Issue