Merge branch 'ad_banner' of https://github.com/Rulingcom/orbit into ad_banner

This commit is contained in:
Matthew K. Fu JuYuan 2012-04-13 12:48:57 +08:00
commit 1e43349eb8
24 changed files with 1125 additions and 1011 deletions

View File

@ -17,4 +17,12 @@ $('.quick_edit_cancel').live('click', function(){
$('#' + tr).hide(); $('#' + tr).hide();
$("tr#bulletin_file_" + $(this).prev().attr('value')).hide(); $("tr#bulletin_file_" + $(this).prev().attr('value')).hide();
$("tr#bulletin_link_" + $(this).prev().attr('value')).hide(); $("tr#bulletin_link_" + $(this).prev().attr('value')).hide();
});
$(document).on('click', '.list-remove', function(){
$('#delete_bulletins').submit();
});
$(document).on('click', '#check_all_bulletins', function(){
$('.checkbox_in_list').attr("checked", this.checked);
}); });

View File

@ -11,4 +11,6 @@
//= require jquery.tinyscrollbar.min //= require jquery.tinyscrollbar.min
//= require orbit-1.0 //= require orbit-1.0
//= require tinymce-jquery //= require tinymce-jquery
//= require tinymce_orbit //= require tinymce_orbit
//= require orbit-bar-search
//= require side_bar_history

View File

@ -0,0 +1,20 @@
$(document).on('click', '.orbit-bar-search', function (){
if ($(this).parents('.search').hasClass('visible')){
$(this).parents('.search').stop().animate({
'width':'28px',
});
$(this).parents('.search').css({
'background-color': 'transparent',
});
$(this).parents('.search').removeClass('visible');
}
else{
$(this).parents('.search').stop().animate({
'width':'265px',
});
$(this).parents('.search').css({
'background-color': 'rgba(0, 0, 0, 0.5)',
});
$(this).parents('.search').addClass('visible');
}
});

View File

@ -1,31 +1,49 @@
$(function () { var history_edited = false;
$('#back_sidebar a, #back_main a.nav').live('click',
function () {
$.getScript(this.href);
history.pushState(null, document.title, this.href);
history_edited = true;
return false;
}
);
$('#back_main a.reload').live('click', $('#back_sidebar a, #back_main a.nav').live('click',
function () { function () {
$.getScript(this.href); $.getScript(this.href);
history.replaceState(null, document.title, this.href); history.pushState(null, document.title, this.href);
history_edited = true;
return false;
}
);
$('.form').live('submit', function () {
$.post(this.action, $(this).serialize(), null, 'script');
history_edited = true; history_edited = true;
return false; return false;
}); }
);
$(window).bind("popstate", function () { $('#back_main a.reload').live('click',
if (history_edited) { function () {
$.getScript(location.href); $.getScript(this.href);
} history.replaceState(null, document.title, this.href);
}); history_edited = true;
return false;
}
);
$('.form').live('submit', function () {
$.post(this.action, $(this).serialize(), null, 'script');
history_edited = true;
return false;
});
$(document).on('click', '.js_history',
function () {
$.getScript(this.href);
history.pushState(null, document.title, this.href);
history_edited = true;
return false;
}
);
$(document).on('click', '.pagination a',
function () {
$.getScript(this.href);
history.pushState(null, document.title, this.href);
history_edited = true;
return false;
}
);
$(window).bind("popstate", function () {
if (history_edited) {
$.getScript(location.href);
}
}); });

View File

@ -102,6 +102,14 @@ table .span1-2 {
float: none; float: none;
margin-left: 0; margin-left: 0;
} }
table .span1-3 {
min-width: 200px;
float: none;
margin-left: 0;
}
.qe-block .form-horizontal .form-actions { .qe-block .form-horizontal .form-actions {
text-align:right; text-align:right;
}
.modal.fade {
top: -50%;
} }

File diff suppressed because it is too large Load Diff

View File

@ -102,18 +102,10 @@ module ApplicationHelper
' web-symbol' if params[:sort].eql?(name) ' web-symbol' if params[:sort].eql?(name)
end end
def add_filter(param_name, value) def is_filter_active?(type, id)
filter = params[:filter] rescue nil ' active' if (@filter[type].include?(id.to_s) rescue nil)
if filter && filter.has_key(param_name)
filter[param_name] << value
elsif filter
filter.merge({param_name => [value]})
else
{param_name => [value]}
end
end end
def process_page(page, id) def process_page(page, id)
parse_page_noko(page, id) parse_page_noko(page, id)
end end
@ -152,6 +144,7 @@ module ApplicationHelper
javascripts << "<script type='text/javascript' src='/assets/jquery.tinyscrollbar.min.js'></script>\n" javascripts << "<script type='text/javascript' src='/assets/jquery.tinyscrollbar.min.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/jquery.isotope.min.js'></script>\n" javascripts << "<script type='text/javascript' src='/assets/jquery.isotope.min.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-member.js'></script>\n" javascripts << "<script type='text/javascript' src='/assets/orbit-bar-member.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>\n" javascripts << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/event.js'></script>\n" javascripts << "<script type='text/javascript' src='/assets/event.js'></script>\n"
page.design.javascripts.each do |js| page.design.javascripts.each do |js|

View File

@ -1,6 +1,7 @@
class Design class Design
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include ParserLayout
field :title field :title
field :author field :author
@ -14,7 +15,7 @@ class Design
embeds_one :reset_css, :class_name => "Stylesheet", :cascade_callbacks => true embeds_one :reset_css, :class_name => "Stylesheet", :cascade_callbacks => true
embeds_many :themes, :cascade_callbacks => true embeds_many :themes, :cascade_callbacks => true
embeds_many :javascripts, :cascade_callbacks => true embeds_many :javascripts, :cascade_callbacks => true
embeds_many :images, :cascade_callbacks => true embeds_many :images, :as => :design_image, :cascade_callbacks => true
# embeds_many :custom_images, :class_name => 'Image', :cascade_callbacks => true # embeds_many :custom_images, :class_name => 'Image', :cascade_callbacks => true
validates_presence_of :title validates_presence_of :title
@ -65,9 +66,6 @@ class Design
protected protected
def parse_css_for_images def parse_css_for_images
self.images.each do |image|
image.save
end
if (self.default_css && self.default_css.changed) if (self.default_css && self.default_css.changed)
self.default_css.parse_urls self.default_css.parse_urls
end end
@ -76,6 +74,7 @@ class Design
theme.parse_urls theme.parse_urls
end end
end end
parse_body_for_images(self)
end end
end end

View File

@ -27,6 +27,7 @@ class Stylesheet < DesignFile
temp_file = File.new(dir + '/' + orig_file_name, 'w+') temp_file = File.new(dir + '/' + orig_file_name, 'w+')
temp_file.write content.force_encoding("UTF-8") temp_file.write content.force_encoding("UTF-8")
self.file = temp_file self.file = temp_file
self.save
} }
end end

View File

@ -15,6 +15,7 @@
</div> </div>
<ul class="nav"> <ul class="nav">
<li><%= link_to t(:homepage), root_path, :class => 'orbit-bar-home' %></li> <li><%= link_to t(:homepage), root_path, :class => 'orbit-bar-home' %></li>
<li><a class="orbit-bar-desktop" href="#">Desktop</a></li>
</ul> </ul>
<ul class="nav pull-right"> <ul class="nav pull-right">
<li class="dropdown language"> <li class="dropdown language">
@ -25,6 +26,13 @@
<% end %> <% end %>
</ul> </ul>
</li> </li>
<li class="search clear">
<a class="orbit-bar-search" href="#">search</a>
<form class="navbar-search" action="">
<input class="search-query span3" type="text" placeholder="<%= t(:search_nccu) %>">
</form>
</li>
<% if user_signed_in? %> <% if user_signed_in? %>
<li class="dropdown active"> <li class="dropdown active">
<a class="orbit-bar-account" href="#" data-toggle="dropdown"> <a class="orbit-bar-account" href="#" data-toggle="dropdown">
@ -94,9 +102,6 @@
</li> </li>
<% end %> <% end %>
</ul> </ul>
<form class="navbar-search span6" action="">
<input class="search-query span4" type="text" placeholder="<%= t(:search_nccu) %>">
</form>
</div> </div>
</div> </div>
</header> </header>

View File

@ -2,7 +2,7 @@ module ParserCommon
def menu_level(page, current, menu, edit = false) def menu_level(page, current, menu, edit = false)
res = '' res = ''
if current <= menu.levels if menu.levels > 0 && current <= menu.levels
if current != 0 if current != 0
res << "<div class='rc_dm'>" res << "<div class='rc_dm'>"
item = rand(100000) item = rand(100000)
@ -84,7 +84,7 @@ module ParserCommon
body.css('.page_image').each do |page_image| body.css('.page_image').each do |page_image|
# image = page.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } # image = page.custom_images.detect{|image| image.name.eql?(tag.attr['name']) }
# image = page.design.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } unless image # image = page.design.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } unless image
image = page.design.images.detect{|image| image.name.eql?(page_image['name']) } unless image image = page.design.images.detect{|image| image.name.eql?(File.basename(page_image['src'])) } unless image
if image if image
res = "<img src=#{image.file.url} " res = "<img src=#{image.file.url} "
page_image.attributes.each do |l| page_image.attributes.each do |l|

View File

@ -8,11 +8,6 @@ module ParserLayout
layout.layout_parts.build(:name => content['name']) layout.layout_parts.build(:name => content['name'])
end end
body.css('.page_image').each do |image|
image = layout.design.images.detect{ |i| i.file_identifier.eql?(parse_html_image(image.to_html)) }
image.update_attributes(:name => image['name'], :html_id => image['id'], :html_class => image['class']) if image
end
body.css('.page_menu').each do |menu| body.css('.page_menu').each do |menu|
layout.build_menu(:levels => 0, :values => {}) unless layout.menu layout.build_menu(:levels => 0, :values => {}) unless layout.menu
layout.menu.levels = i = menu['level'].to_i layout.menu.levels = i = menu['level'].to_i
@ -22,12 +17,14 @@ module ParserLayout
end end
def parse_html_image(html) def parse_body_for_images(design)
html.scan(/(?<=\<img)(.*?)(?=\/\>)/){ body = Nokogiri::HTML(design.layout.body)
$1.gsub(' ','').scan(/(?<=src=\")(.*?)(?=\")/){
return File.basename($1).gsub(/[\\\"]/, '') body.css('.page_image').each do |page_image|
} image = design.images.where( file: File.basename(page_image['src']))[0]
} image.update_attributes(:name => File.basename(page_image['src']), :html_id => page_image['id'], :html_class => page_image['class']) if image
end
end end

View File

@ -9,11 +9,28 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
get_categorys(params[:bulletin_category_id]) get_categorys(params[:bulletin_category_id])
get_tags get_tags
@filter = params[:filter]
new_filter = params[:new_filter]
if @filter && params[:clear]
@filter.delete(params[:type])
elsif @filter && new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s
else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
end
elsif new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
end
# @bulletins = Bulletin.where("bulletin_category_id" => params[:bulletin_category_id]).desc("postdate") if 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])
# @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]]) # @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]])
@bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all.page(params[:page]).per(10) @bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered_bulletins : Bulletin.all.page(params[:page]).per(10)
@bulletin_categories = BulletinCategory.all @bulletin_categories = BulletinCategory.all
@bulletin_link = BulletinLink.new @bulletin_link = BulletinLink.new
@ -24,7 +41,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.js format.js { }
format.xml { render :xml => @bulletins } format.xml { render :xml => @bulletins }
end end
end end
@ -273,6 +290,13 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
get_tags get_tags
end end
def delete
if params[:to_delete]
bulletins = Bulletin.any_in(:_id => params[:to_delete]).delete_all
end
redirect_to panel_announcement_back_end_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort])
end
protected protected
@ -285,21 +309,16 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
end end
end end
def get_tags
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
end
def get_tags def get_tags
module_app = ModuleApp.first(:conditions => {:key => 'announcement'}) module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc) @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
end end
def get_sorted_bulletins def get_sorted_and_filtered_bulletins
bulletins = Bulletin.all bulletins = Bulletin.all
case params[:sort] case params[:sort]
when 'postdate', 'deadline' when 'postdate', 'deadline'
bulletins.order_by([params[:sort], params[:direction]]).page(params[:page]).per(10) bulletins = bulletins.order_by([params[:sort], params[:direction]])
when 'category' when 'category'
category_ids = bulletins.distinct(:bulletin_category_id) category_ids = bulletins.distinct(:bulletin_category_id)
categories = BulletinCategory.find(category_ids) rescue nil categories = BulletinCategory.find(category_ids) rescue nil
@ -308,19 +327,15 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
categories.each { |category| h[category.i18n_variable[I18n.locale]] = category.id } categories.each { |category| h[category.i18n_variable[I18n.locale]] = category.id }
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse! sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
sorted_categorys = sorted.collect {|a| bulletins.where(:bulletin_category_id => a[1]).entries } sorted_categorys = sorted.collect {|a| bulletins.where(:bulletin_category_id => a[1]).entries }
sorted_categorys.flatten! bulletins = sorted_categorys.flatten!
Kaminari.paginate_array(sorted_categorys).page(params[:page]).per(10)
else
nil
end end
when 'title' when 'title'
h = Array.new h = Array.new
bulletins.each { |bulletin| h << [bulletin.title[I18n.locale].downcase, bulletin] } bulletins.each { |bulletin| h << [bulletin.title[I18n.locale].downcase, bulletin] }
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse! sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
sorted_titles = sorted.collect {|a| a[1] } bulletins = sorted.collect {|a| a[1] }
Kaminari.paginate_array(sorted_titles).page(params[:page]).per(10)
when 'status' when 'status'
bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction]).page(params[:page]).per(10) bulletins = bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction])
when 'update_user_id' when 'update_user_id'
user_ids = bulletins.distinct(:update_user_id) user_ids = bulletins.distinct(:update_user_id)
users = User.find(user_ids) rescue nil users = User.find(user_ids) rescue nil
@ -329,10 +344,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
users.each { |user| h << [user.name, user.id] } users.each { |user| h << [user.name, user.id] }
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse! sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
sorted_users = sorted.collect {|a| bulletins.where(:update_user_id => a[1]).entries } sorted_users = sorted.collect {|a| bulletins.where(:update_user_id => a[1]).entries }
sorted_users.flatten! bulletins = sorted_users.flatten
Kaminari.paginate_array(sorted_users).page(params[:page]).per(10)
else
nil
end end
when 'tags' when 'tags'
a = Array.new a = Array.new
@ -344,10 +356,37 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse! sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
sorted_titles = sorted.collect {|a| a[1] } sorted_titles = sorted.collect {|a| a[1] }
a = params[:direction].eql?('asc') ? (sorted_titles + a) : (a + sorted_titles) a = params[:direction].eql?('asc') ? (sorted_titles + a) : (a + sorted_titles)
a.flatten! bulletins = a.flatten
Kaminari.paginate_array(a).page(params[:page]).per(10)
end end
if @filter
@filter.each do |key, value|
case key
when 'status'
a = Array.new
bulletins.each do |bulletin|
value.each do |v|
a << bulletin if bulletin[v]
end
end
bulletins = a
when 'categories'
a = Array.new
bulletins.each do |bulletin|
a << bulletin if value.include?(bulletin.bulletin_category.id.to_s)
end
bulletins = a
when 'tags'
a = Array.new
bulletins.each do |bulletin|
bulletin.tags.each do |tag|
a << bulletin if value.include?(tag.id.to_s)
end
end
bulletins = a
end if value.size > 0
end
end
Kaminari.paginate_array(bulletins).page(params[:page]).per(10)
end end
end end

View File

@ -1,5 +1,5 @@
<tr id="<%= dom_id bulletin %>" class="with_action"> <tr id="<%= dom_id bulletin %>" class="with_action">
<td><input type="checkbox"></td> <td><%= check_box_tag 'to_delete[]', bulletin.id, false, :class => "checkbox_in_list" %></td>
<td> <td>
<% if bulletin.is_top? %> <% if bulletin.is_top? %>
<span class="label label-success"><%= t(:top) %></span> <span class="label label-success"><%= t(:top) %></span>

View File

@ -7,9 +7,9 @@
<th class="span1-2"></th> <th class="span1-2"></th>
<th class="span1-2"></th> <th class="span1-2"></th>
<th class="span1-2"></th> <th class="span1-2"></th>
<th class="span1-2"></th> <th class="span1-3"></th>
</tr> </tr>
</thead> </thead>
<tbody class="sort-holder"> <tbody id="tbody_bulletins" class="sort-holder">
<%= render :partial => 'bulletin', :collection => @bulletins %> <%= render :partial => 'bulletin', :collection => @bulletins %>
</tbody> </tbody>

View File

@ -0,0 +1,3 @@
<div class="filter-clear">
<%= link_to content_tag(:i, nil, :class => 'icons-brush-large') + t(:clear), panel_announcement_back_end_bulletins_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn js_history" %>
</div>

View File

@ -18,73 +18,16 @@
</ul> </ul>
<div class="filters"> <div class="filters">
<div class="accordion-body collapse" id="collapse-status"> <div class="accordion-body collapse" id="collapse-status">
<div class="accordion-inner" data-toggle="buttons-checkbox"> <%= render 'filter_status' %>
<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>
<div class="accordion-body collapse" id="collapse-category"> <div class="accordion-body collapse" id="collapse-category">
<div class="accordion-inner" data-toggle="buttons-checkbox"> <%= render 'filter_categories' %>
<% @bulletin_categories.each do |category| -%>
<%= link_to category.i18n_variable[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => add_filter(:categories, category.id)), :class => 'btn' %>
<% end -%>
</div>
<div class="filter-clear">
<a href="#" class="btn"><i class="icons-brush-large"></i>Clear/重置</a>
</div>
</div> </div>
<div class="accordion-body collapse" id="collapse-tags"> <div class="accordion-body collapse" id="collapse-tags">
<div class="accordion-inner" data-toggle="buttons-checkbox"> <%= render 'filter_tags' %>
<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 class="table-label"> <div id="sort_headers" class="table-label">
<table class="table main-list"> <%= render 'sort_headers' %>
<thead>
<tr class="sort-header">
<th class="span1 strong">
<input type="checkbox">
<a href class="list-remove"><i class="icon-trash"></i></a>
</th>
<th class="sort span1-2 <%= is_sort_active?('status') %>">
<%= link_to t('bulletin.status') + content_tag(:b, nil, :class => is_sort?('status')), panel_announcement_back_end_bulletins_path(sortable('status')) %>
</th>
<th class="sort span1-2 <%= is_sort_active?('category') %>">
<%= link_to t('bulletin.category') + content_tag(:b, nil, :class => is_sort?('category')), panel_announcement_back_end_bulletins_path(sortable('category')) %>
</th>
<th class="sort span7 <%= is_sort_active?('title') %>">
<%= link_to t('bulletin.title') + content_tag(:b, nil, :class => is_sort?('title')), panel_announcement_back_end_bulletins_path(sortable('title')) %>
</th>
<th class="sort span1-2 <%= is_sort_active?('postdate') %>">
<%= link_to t('bulletin.start_date') + content_tag(:b, nil, :class => is_sort?('postdate')), panel_announcement_back_end_bulletins_path(sortable('postdate')) %>
</th>
<th class="sort span1-2 <%= is_sort_active?('deadline') %>">
<%= link_to t('bulletin.end_date') + content_tag(:b, nil, :class => is_sort?('deadline')), panel_announcement_back_end_bulletins_path(sortable('deadline')) %>
</th>
<th class="sort span1-2 <%= is_sort_active?('tags') %>">
<%= link_to t('bulletin.tags') + content_tag(:b, nil, :class => is_sort?('tags')), panel_announcement_back_end_bulletins_path(sortable('tags')) %>
</th>
<th class="sort span1-2 <%= is_sort_active?('update_user_id') %>">
<%= link_to t('bulletin.last_modified') + content_tag(:b, nil, :class => is_sort?('update_user_id')), panel_announcement_back_end_bulletins_path(sortable('update_user_id')) %>
</th>
</tr>
</thead>
</table>
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,6 @@
<div class="accordion-inner" data-toggle="buttons-checkbox">
<% @bulletin_categories.each do |category| -%>
<%= link_to category.i18n_variable[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %>
<% end -%>
</div>
<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %>

View File

@ -0,0 +1,7 @@
<div class="accordion-inner" data-toggle="buttons-checkbox">
<%= link_to t(:is_top), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_top'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_top')}" %>
<%= link_to t(:is_hot), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hot'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_hot')}" %>
<%= link_to t(:is_hidden), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hidden'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_hidden')}" %>
<%= link_to t(:is_checked), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_checked'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_checked')}" %>
</div>
<%= render :partial => 'clear_filters', :locals => {:type => 'status'} %>

View File

@ -0,0 +1,6 @@
<div class="accordion-inner" data-toggle="buttons-checkbox">
<% @tags.each do |tag| -%>
<%= link_to tag[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'tags', :id => tag.id}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('tags', tag.id)}" %>
<% end -%>
</div>
<%= render :partial => 'clear_filters', :locals => {:type => 'tags'} %>

View File

@ -0,0 +1,31 @@
<table class="table main-list">
<thead>
<tr class="sort-header">
<th class="span1 strong">
<input id="check_all_bulletins" type="checkbox">
<a href='#' class="list-remove"><i class="icon-trash"></i></a>
</th>
<th class="sort span1-2 <%= is_sort_active?('status') %>">
<%= link_to t('bulletin.status') + content_tag(:b, nil, :class => is_sort?('status')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('status'))), :class => 'js_history' %>
</th>
<th class="sort span1-2 <%= is_sort_active?('category') %>">
<%= link_to t('bulletin.category') + content_tag(:b, nil, :class => is_sort?('category')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('category'))), :class => 'js_history' %>
</th>
<th class="sort span7 <%= is_sort_active?('title') %>">
<%= link_to t('bulletin.title') + content_tag(:b, nil, :class => is_sort?('title')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('title'))), :class => 'js_history' %>
</th>
<th class="sort span1-2 <%= is_sort_active?('postdate') %>">
<%= link_to t('bulletin.start_date') + content_tag(:b, nil, :class => is_sort?('postdate')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('postdate'))), :class => 'js_history' %>
</th>
<th class="sort span1-2 <%= is_sort_active?('deadline') %>">
<%= link_to t('bulletin.end_date') + content_tag(:b, nil, :class => is_sort?('deadline')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('deadline'))), :class => 'js_history' %>
</th>
<th class="sort span1-2 <%= is_sort_active?('tags') %>">
<%= link_to t('bulletin.tags') + content_tag(:b, nil, :class => is_sort?('tags')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('tags'))), :class => 'js_history' %>
</th>
<th class="sort span1-3 <%= is_sort_active?('update_user_id') %>">
<%= link_to t('bulletin.last_modified') + content_tag(:b, nil, :class => is_sort?('update_user_id')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('update_user_id'))), :class => 'js_history' %>
</th>
</tr>
</thead>
</table>

View File

@ -1,20 +1,18 @@
<%= render 'filter' %> <%= form_for :bulletins, :url => delete_panel_announcement_back_end_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil), :html => {:id => 'delete_bulletins'}, :remote => true do %>
<table id="bulettin_sort_list" class="table main-list"> <%= render 'filter' %>
<%= render 'bulletins' %> <table id="bulettin_sort_list" class="table main-list">
</table> <%= render 'bulletins' %>
</table>
<% end %>
<%= paginate @bulletins %> <div id="bulletin_pagination">
<%= paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
<div id="bulletin_link_qe"> <div id="bulletin_link_qe">
<div id="modal-link" class="modal fade"> <div id="modal-link" class="modal fade">
<%= render :partial => "bulletin_link_qe" %> <%= render :partial => "bulletin_link_qe" %>
</div> </div>
</div>
<div id="bulletin_file_qe">
<div id="modal-file" class="modal fade">
<%= render :partial => "bulletin_file_qe" %>
</div>
</div> </div>
<div class="form-actions"> <div class="form-actions">
@ -24,3 +22,4 @@
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "bulletin_form" %> <%= javascript_include_tag "bulletin_form" %>
<% end %> <% end %>

View File

@ -0,0 +1,7 @@
$("#collapse-status").html("<%= j render 'filter_status' %>");
$("#collapse-category").html("<%= j render 'filter_categories' %>");
$("#collapse-tags").html("<%= j render 'filter_tags' %>");
$("#delete_bulletins").attr("action", "<%= delete_panel_announcement_back_end_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter]) %>");
$("#sort_headers").html("<%= j render 'sort_headers' %>");
$("#tbody_bulletins").html("<%= j render :partial => 'bulletin', :collection => @bulletins %>");
$("#bulletin_pagination").html("<%= j paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");

View File

@ -6,13 +6,15 @@ Rails.application.routes.draw do
match 'fact_check_setting' => "fact_checks#setting" ,:as => :fact_checks_setting match 'fact_check_setting' => "fact_checks#setting" ,:as => :fact_checks_setting
match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting
root :to => "bulletins#index"
resources :bulletins do resources :bulletins do
match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add
match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit
member do member do
get 'load_quick_edit' get 'load_quick_edit'
end end
collection do
post 'delete'
end
match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
end end