archive edit & plugins edit

This commit is contained in:
Spen 2013-03-07 17:59:53 +08:00 committed by chris
parent 147b7b9292
commit d7d480ac12
40 changed files with 681 additions and 155 deletions

View File

@ -15,11 +15,11 @@ class Admin::PluginsController < ApplicationController
format.html { redirect_to( @right_partial ) } format.html { redirect_to( @right_partial ) }
end end
else else
@right_partial = "admin/users_new_interface/plugin_summary" @right_partial = ""
end end
else else
@right_partial = "admin/users_new_interface/plugin_summary" @right_partial = ""
end end
end end

View File

@ -5,5 +5,5 @@
<div id="isotope" class="user-data"> <div id="isotope" class="user-data">
<%= render :partial => 'plugin_list' %> <%= render :partial => 'plugin_list' %>
<%= render :partial => @right_partial %> <%= render :partial => @right_partial if !@right_partial.blank? %>
</div> </div>

View File

@ -0,0 +1,133 @@
/* General style with default layout */
.o-archives {}
.o-archives-content {}
.o-archives-group {
margin: 20px 0 0 0;
padding: 20px 0 0 0;
border-top: dashed 1px #eee;
}
.o-archives-group:first-child {
margin: 0;
padding: 0;
border: 0;
}
.o-archives-category {
padding-bottom: 16px;
border-bottom: solid 2px #ccc;
font-weight: bold;
}
.o-archives-list {}
.o-archives-list ul {
margin: 0;
padding: 0;
list-style: none;
}
.o-archives-list li {}
.o-archives-title {
border-left: solid 8px #eee;
border-bottom: solid 1px #eee;
padding: 0 0 0 16px;
}
.o-archives-list-item {}
.o-archives-list-item ol {}
.o-archives-list-item li {
margin: 0 0 10px 0;
}
.o-archives-file {}
.o-archives-file:hover {}
.o-archives-file-type {
display: inline-block;
vertical-align: top;
margin-left: 8px;
padding: 0 6px;
height: 16px;
font-size: 10px;
text-transform: uppercase;
line-height: 16px;
background-color: #666;
color: #fff;
border-radius: 3px;
}
/* Tag list */
.o-archives-tag-list {}
.o-archives-tag-list ul {
margin: 0 -4px;
padding: 0;
list-style: none;
}
.o-archives-tag-list ul:after {
content: ".";
clear: both;
display: block;
height: 0;
visibility: hidden;
}
.o-archives-tag-list li {
float: left;
margin: 0 4px 8px 4px;
}
.o-archives-tag {
display: block;
border: solid 1px #ccc;
padding: 2px 6px;
}
.o-archives-tag:hover {}
/* Table layout */
.o-archives.layout-table {}
.o-archives-search {
overflow: hidden;
margin: 0 0 10px 0;
}
.o-archives-search label {
display: inline-block;
margin: 0 8px 0 0;
}
.o-archives-search-option {
float: right;
}
.o-archives-search-option select {
width: 80px;
}
.o-archives-search-keyword {}
.o-archives-search-keyword input[type=submit] {
display: inline-block;
vertical-align: top;
margin: 0 0 0 8px;
}
.o-archives.layout-table table {
width: 100%;
table-layout: fixed;
}
.o-archives.layout-table tbody td {
vertical-align: top;
border-top: solid 1px #eee;
padding: 8px 4px;
}
.o-archives.layout-table .even {}
.o-archives.layout-table .even td {}
.o-archives.layout-table .column-ctrl {
text-align: left;
}
.o-archives.layout-table .column-ctrl.col-title { width: 30% }
.o-archives.layout-table .column-ctrl.col-file {}
.o-archives.layout-table .column-ctrl.col-category { width: 15%; }
.o-archives.layout-table .column-ctrl.col-tag { width: 20%; }
.o-archives.layout-table .o-archives-title {
font-weight: bold;
border: 0;
padding: 0;
}
.o-archives.layout-table .o-archives-category {
padding: 0;
margin: 0;
border: 0;
}
.o-archives.layout-table .o-archives-tag {
display: inline-block;
margin-bottom: 3px;
}
.o-archives.layout-table .o-archives-category {
font-weight: normal;
}

View File

@ -1,7 +1,11 @@
class Panel::Archive::BackEnd::ArchiveFileCategorysController < OrbitBackendController class Panel::Archive::BackEnd::ArchiveFileCategorysController < OrbitBackendController
before_filter :for_app_manager,:except => [:index]
include OrbitControllerLib::DivisionForDisable
def index def index
@archive_file_categorys = ArchiveFileCategory.all @archive_file_categorys = get_categories_for_index("ArchiveFileCategory")
# @archive_file_categorys = ArchiveFileCategory.all
@archive_file_category = ArchiveFileCategory.new(:display => 'List') @archive_file_category = ArchiveFileCategory.new(:display => 'List')
@url = panel_archive_back_end_archive_file_categorys_path @url = panel_archive_back_end_archive_file_categorys_path
@ -85,12 +89,19 @@ class Panel::Archive::BackEnd::ArchiveFileCategorysController < OrbitBackendCont
# DELETE /archive_files/1.xml # DELETE /archive_files/1.xml
def destroy def destroy
@archive_file_category = ArchiveFileCategory.find(params[:id]) @archive_file_category = ArchiveFileCategory.find(params[:id])
@archive_file_category.destroy @archive_file_category.disable = @archive_file_category.disable ? false : true
if @archive_file_category.save!
respond_to do |format| respond_to do |format|
flash[:notice] = t("update.success_")
# flash[:error] += @archive_file_category.disable ? t(:enable) : t(disable)
format.html { redirect_to(panel_archive_back_end_archive_file_categorys_url) } format.html { redirect_to(panel_archive_back_end_archive_file_categorys_url) }
# format.xml { head :ok } # format.xml { head :ok }
format.js format.js
end end
else
flash[:error] = t("update.fail")
format.html { render :action => "index" }
end
end end
end end

View File

@ -1,20 +1,45 @@
class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController
# before_filter :for_app_manager,:except => [:index,:show]
include OrbitControllerLib::DivisionForDisable
before_filter :force_order_for_visitor,:only=>[:index] before_filter :force_order_for_visitor,:only=>[:index]
before_filter :force_order_for_user,:except => [:index] before_filter :force_order_for_user,:except => [:index]
before_filter :for_app_sub_manager,:except => [:index] before_filter :for_app_sub_manager,:except => [:index]
before_filter :only => [ :new,:edit,:update,:create] do |controller|
controller.get_categorys('ArchiveFileCategory')
end
def index def index
get_categorys(params[:archive_file_category_id]) get_categorys("ArchiveFileCategory",params[:archive_file_category_id])
@filter = params[:filter]
new_filter = params[:new_filter]
@archive_files = ArchiveFile.all.page(params[:page]).per(10) 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
@archive_filecategories = get_categories_for_index("ArchiveFileCategory")
@archive_file_category_ids = @archive_file_categories.collect{|t| t.id.to_s} + [nil]
@archive_files = (params[:sort] || @filter) ? get_sorted_and_filtered("archive_file",:archive_file_category_id.in => @archive_file_category_ids) : get_viewable("archive_file",:archive_file_category_id.in => @archive_file_category_ids)
get_tags get_tags
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.js
format.xml { render :xml => @archive_files } format.xml { render :xml => @archive_files }
format.js
end end
end end
@ -22,7 +47,6 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController
# GET /archive_files/1.xml # GET /archive_files/1.xml
def show def show
@archive_file = ArchiveFile.find(params[:id]) @archive_file = ArchiveFile.find(params[:id])
# get_categorys
respond_to do |format| respond_to do |format|
format.html # show.html.erb format.html # show.html.erb
@ -35,8 +59,6 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController
def new def new
@archive_file = ArchiveFile.new @archive_file = ArchiveFile.new
get_categorys
get_tags get_tags
respond_to do |format| respond_to do |format|
@ -48,7 +70,7 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController
# GET /archive_files/1/edit # GET /archive_files/1/edit
def edit def edit
@archive_file = ArchiveFile.find(params[:id]) @archive_file = ArchiveFile.find(params[:id])
get_categorys
get_tags get_tags
end end
@ -64,7 +86,6 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController
format.html { redirect_to(panel_archive_back_end_archive_files_url) } format.html { redirect_to(panel_archive_back_end_archive_files_url) }
format.xml { render :xml => @archive_file, :status => :created, :location => @archive_file } format.xml { render :xml => @archive_file, :status => :created, :location => @archive_file }
else else
get_categorys
get_tags get_tags
format.html { render :action => "new" } format.html { render :action => "new" }
format.xml { render :xml => @archive_file.errors, :status => :unprocessable_entity } format.xml { render :xml => @archive_file.errors, :status => :unprocessable_entity }
@ -83,7 +104,7 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController
respond_to do |format| respond_to do |format|
if @archive_file.update_attributes(params[:archive_file]) if @archive_file.update_attributes(params[:archive_file])
format.html { redirect_to(panel_archive_back_end_archive_files_url) } format.html { redirect_to(panel_archive_back_end_archive_files_url(:page => params[:page])) }
format.xml { head :ok } format.xml { head :ok }
else else
format.html { render :action => "edit" } format.html { render :action => "edit" }
@ -105,11 +126,18 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController
end end
end end
def delete
if params[:ids]
archive_files = ArchiveFile.any_in(:_id => params[:ids]).destroy_all
end
redirect_to panel_archive_back_end_archive_files_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
protected protected
def get_categorys(id = nil) # def get_categorys(id = nil)
@archive_file_categorys = (id ? ArchiveFileCategory.find(id).to_a : ArchiveFileCategory.excludes('disabled' => true)) # @archive_file_categorys = (id ? ArchiveFileCategory.find(id).to_a : ArchiveFileCategory.excludes('disabled' => true))
end # end
def get_tags def get_tags
module_app = ModuleApp.first(:conditions => {:key => 'archive'}) module_app = ModuleApp.first(:conditions => {:key => 'archive'})

View File

@ -24,69 +24,24 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
# @archive_files = ArchiveFile.where( :is_hidden => false ).desc(:is_top).page(params[:page]).per(@page_num) # @archive_files = ArchiveFile.where( :is_hidden => false ).desc(:is_top).page(params[:page]).per(@page_num)
if !params[:category_id].blank? if !params[:category_id].blank?
@archive_files = ArchiveFile.can_display.where(:archive_file_category_id => params[:category_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num) @archive_files = ArchiveFile.all.can_display.any_in(:archive_file_category_id => params[:category_id]).merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil @current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
elsif !params[:tag_id].blank? elsif !params[:tag_id].blank?
@tag = ArchiveTag.find(params[:tag_id]) rescue nil @tag = ArchiveTag.find(params[:tag_id]) rescue nil
@tag = ArchiveTag.where(key: params[:tag_id])[0] unless @tag @tag = ArchiveTag.where(key: params[:tag_id])[0] unless @tag
@archive_files = @tag.archive_files.can_display.desc( :is_top ).page( params[:page_main] ).per(@page_num) @archive_files = @tag.archive_files.can_display.desc( :is_top ).page( params[:page_main] ).per(@page_num)
get_categorys
else else
@archive_files = ArchiveFile.can_display.desc( :is_top ).page( params[:page_main] ).per(@page_num) @archive_files = ArchiveFile.all.can_display.merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top ).page( params[:page_main] ).per(@page_num)
end
get_categorys get_categorys
end end
def show
@item = Page.find(params[:page_id])
@title = @item.title
@archive_file = ArchiveFile.find(params[:id])
get_categorys
end
protected
def reload_archive_files
@item = Page.find(params[:page_id])
@title = @item.title
if @item.frontend_data_count
@page_num = @item.frontend_data_count
else
@page_num = 0
end
date_now = Time.now
@archive_file_categorys = ArchiveFileCategory.all
# @archive_files = ArchiveFile.where( :is_hidden => false ).desc(:is_top).page(params[:page]).per(@page_num)
if !params[:category_id].blank?
@archive_files = ArchiveFile.can_display.where(:archive_file_category_id => params[:category_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
elsif !params[:tag_id].blank?
@tag = ArchiveTag.find(params[:tag_id]) rescue nil
@tag = ArchiveTag.where(key: params[:tag_id])[0] unless @tag
@archive_files = @tag.archive_files.can_display.desc( :is_top ).page( params[:page_main] ).per(@page_num)
else
@archive_files = ArchiveFile.can_display.desc( :is_top ).page( params[:page_main] ).per(@page_num)
end
get_categorys
end end
def get_categorys def get_categorys
@archive_file_categorys = ArchiveFileCategory.excludes('disabled' => true) @archive_file_categorys = ArchiveFileCategory.excludes('disable' => true)
end end
end end

View File

@ -0,0 +1,48 @@
class Panel::Archive::Widget::ArchiveFilesController < OrbitWidgetController
def initialize
super
@app_title = 'archive_files'
end
def index
@part = PagePart.find(params[:part_id])
if @part.widget_data_count
@page_num = @part.widget_data_count
else
@page_num = 4
end
if @part.widget_field
@widget_fields = @part.widget_field
else
@widget_fields = []
end
@widget_style = @part.widget_style
@category_id = @part.category
date_now = Time.now
if !params[:category_id].blank?
@archive_files = ArchiveFile.all.can_display.any_in(:archive_file_category_id => params[:category_id]).merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@archive_file_categorys = ArchiveFileCategory.any_in(:_id => params[:category_id]).excludes('disable' => true)
elsif !params[:tag_id].blank?
@tag = ArchiveTag.find(params[:tag_id]) rescue nil
@tag = ArchiveTag.where(key: params[:tag_id])[0] unless @tag
get_categorys
else
@archive_files = ArchiveFile.all.can_display.merge(ArchiveFileCategory.excludes('disable' => true)).desc( :is_top ).page( params[:page_main] ).per(@page_num)
get_categorys
end
end
def get_categorys
@archive_file_categorys = ArchiveFileCategory.excludes('disable' => true)
end
end

View File

@ -5,6 +5,9 @@ class ArchiveFile
include Mongoid::Timestamps include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes include Mongoid::MultiParameterAttributes
BelongsToCategory = :archive_file_category
include OrbitCoreLib::BelongsToCategoryMayDisable
PAYMENT_TYPES = @site_valid_locales PAYMENT_TYPES = @site_valid_locales
field :title, localize: true field :title, localize: true
@ -20,7 +23,7 @@ class ArchiveFile
scope :can_display,where(is_hidden: false) scope :can_display,where(is_hidden: false)
belongs_to :archive_file_category # belongs_to :archive_file_category
has_many :archive_file_multiples, :autosave => true, :dependent => :destroy has_many :archive_file_multiples, :autosave => true, :dependent => :destroy
@ -55,6 +58,15 @@ class ArchiveFile
self.is_top self.is_top
end end
def sorted_tags
tags.order_by(I18n.locale, :asc)
end
def get_file_icon( file_data )
file_icon = "<span class=\"o-archives-file-type\">#{file_data.split('.')[1]}</span>".html_safe
end
def save_archive_file_multiples def save_archive_file_multiples
self.archive_file_multiples.each do |t| self.archive_file_multiples.each do |t|
if t.should_destroy if t.should_destroy

View File

@ -3,16 +3,26 @@
class ArchiveFileCategory class ArchiveFileCategory
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include OrbitCoreLib::ObjectAuthable
include OrbitCoreLib::ObjectDisable
# include Mongoid::MultiParameterAttributes # include Mongoid::MultiParameterAttributes
APP_NAME = 'Archive'
ObjectAuthTitlesOptions = %W{submit_new fact_check}
AfterObjectAuthUrl = '/panel/archive/back_end/archive_file_categorys'
field :disable, type: Boolean, :default => false
field :display
field :key field :key
field :title, localize: true field :title, localize: true
has_many :archive_files has_many :archive_files
validates :title, :at_least_one => true validates :title, :at_least_one => true
def pp_object
title
end
def self.from_id(id) def self.from_id(id)
ArchiveFileCategory.find(id) rescue nil ArchiveFileCategory.find(id) rescue nil
end end

View File

@ -6,6 +6,7 @@
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
<li><%= link_to t('archive_file_category.edit'), edit_panel_archive_back_end_archive_file_category_path(archive_file_category), :remote => true %></li> <li><%= link_to t('archive_file_category.edit'), edit_panel_archive_back_end_archive_file_category_path(archive_file_category), :remote => true %></li>
<li><%= link_to show_toggle_archive_btn(archive_file_category) , panel_archive_back_end_archive_file_category_path(archive_file_category), :confirm => t(:sure?), :method => :delete, :remote => true,:class=> "archive_toggle" %></li>
<!-- <li><%#= link_to t('archive_file_category.delete'), panel_archive_back_end_archive_file_category_path(archive_file_category), :confirm => t('sure?'), :method => :delete, :remote => true %></li> --> <!-- <li><%#= link_to t('archive_file_category.delete'), panel_archive_back_end_archive_file_category_path(archive_file_category), :confirm => t('sure?'), :method => :delete, :remote => true %></li> -->
</ul> </ul>
</div> </div>

View File

@ -1 +1 @@
$("#<%= dom_id @archive_file_category %>").remove(); $("#<%= dom_id @archive_file_category %>").find(".archive_toggle").text("<%= show_toggle_archive_btn(@archive_file_category) %> ");

View File

@ -1,6 +1,12 @@
<tr id="<%= dom_id archive_file %>" class="with_action"> <tr id="<%= dom_id archive_file %>" class="with_action">
<td> <td>
<% if (archive_file.create_user_id == current_or_guest_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', archive_file.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td>
<div class="label-group">
<div class="label-td">
<% if archive_file.is_top? %> <% if archive_file.is_top? %>
<span class="label label-success"><%= t(:top) %></span> <span class="label label-success"><%= t(:top) %></span>
<% end %> <% end %>
@ -10,23 +16,30 @@
<% if archive_file.is_hidden? %> <% if archive_file.is_hidden? %>
<span class="label"><%= t(:hidden) %></span> <span class="label"><%= t(:hidden) %></span>
<% end %> <% end %>
<% if is_manager?%>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('archive_file.edit'), edit_panel_archive_back_end_archive_file_path(archive_file) %></li>
<li><%= link_to t('archive_file.delete'), panel_archive_back_end_archive_file_path(archive_file), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
</ul>
</div> </div>
<%end%> </div>
</td> </td>
<td><%= archive_file.archive_file_category.title %></td> <td><%= archive_file.archive_file_category.title %></td>
<td> <td>
<%= link_to archive_file.title, panel_archive_front_end_archive_file_path(archive_file) %> <%= link_to archive_file.title, panel_archive_front_end_archive_file_path(archive_file) %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<%if at_least_module_manager || archive_file.archive_file_category.cur_user_is_sub_manager_of(:edit)%>
<li><%= link_to t('edit'), edit_panel_archive_back_end_archive_file_path(archive_file, :page => params[:page], :filter => @filter) %></li>
<li><%= link_to t(:delete_), panel_archive_back_end_archive_file_path(archive_file), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
<% end -%>
</ul>
</div>
</td> </td>
<td> <td>
<% archive_file.tags.each do |tag| %> <div class="label-group">
<div class="label-td">
<% archive_file.sorted_tags.each do |tag| %>
<span class="label label-tags"><%= tag[I18n.locale] %></span> <span class="label label-tags"><%= tag[I18n.locale] %></span>
<% end %> <% end %>
</div>
</div>
</td> </td>
</tr> </tr>

View File

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

View File

@ -0,0 +1,37 @@
<div id='filter' 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="#filter" 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="#filter" class="accordion-toggle"><%= t(:categories) %> <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="#filter" class="accordion-toggle"><%= t(:tags) %> <b class="web-symbol"></b></a>
</div>
</li>
</ul>
<div class="filters accordion-group">
<div class="accordion-body collapse" id="collapse-status">
<%= render 'filter_status' %>
</div>
<div class="accordion-body collapse" id="collapse-category">
<%= render 'filter_categories' %>
</div>
<div class="accordion-body collapse" id="collapse-tags">
<%= render 'filter_tags' %>
</div>
<div id="sort_headers" class="table-label">
<%= render 'sort_headers' %>
</div>
</div>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "sort_header" %>
<% end %>

View File

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

View File

@ -0,0 +1,6 @@
<div class="accordion-inner" data-toggle="buttons-checkbox">
<%= link_to t(:top), panel_archive_back_end_archive_files_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_top'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_top')}" %>
<%= link_to t(:hot), panel_archive_back_end_archive_files_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hot'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_hot')}" %>
<%= link_to t(:hidden), panel_archive_back_end_archive_files_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hidden'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_hidden')}" unless(is_guest?)%>
</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_archive_back_end_archive_files_path(:filter => @filter, :new_filter => {:type => 'tags', :id => tag.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('tags', tag.id)}" %>
<% end -%>
</div>
<%= render :partial => 'clear_filters', :locals => {:type => 'tags'} %>

View File

@ -98,7 +98,7 @@
</tfoot> </tfoot>
<tbody> <tbody>
<% @archive_file.archive_file_multiples.each_with_index do |archive_file_multiple, i| %> <% @archive_file.archive_file_multiples.desc("id asc").each_with_index do |archive_file_multiple, i| %>
<%= f.fields_for :archive_file_multiples, archive_file_multiple do |f| %> <%= f.fields_for :archive_file_multiples, archive_file_multiple do |f| %>
<%= render :partial => 'form_file', :object => archive_file_multiple, :locals => {:f => f, :i => i} %> <%= render :partial => 'form_file', :object => archive_file_multiple, :locals => {:f => f, :i => i} %>
<% end %> <% end %>
@ -117,6 +117,8 @@
<div class="form-actions"> <div class="form-actions">
<%= hidden_field_tag 'page', params[:page] if !params[:page].blank? %>
<%= hidden_field_tag 'filter', params[:filter] %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %> <%= f.submit t('submit'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %> <%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div> </div>

View File

@ -0,0 +1,5 @@
<%= render_sort_bar(true, delete_panel_archive_back_end_archive_files_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
['status', ['is_top', 'is_hot', 'is_hidden'], 'span1', :status],
['category', 'archive_file_category', 'span2', :category],
['title', 'title','span3', :title],
['tags', 'tags', 'span2', :tags]).html_safe %>

View File

@ -1,13 +1,13 @@
<%= render 'filter' %>
<%= flash_messages %>
<table class="table main-list"> <table class="table main-list">
<thead> <thead>
<tr> <tr>
<th class="span1-2"><%= t('archive_file.status') %></th> <th class="span1"></th>
<th class="span1-2"><%= t('archive_file.category') %></th> <th class="span1"></th>
<th class="span1-2"><%= t('archive_file.title') %></th> <th class="span2"></th>
<th class="span1-2"><%= t('archive_file.tags') %></th> <th class="span3"></th>
<th class="span2"></th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody_archive"> <tbody id="tbody_archive">
@ -18,3 +18,11 @@
<div id="archive_pagination"> <div id="archive_pagination">
<%= paginate @archive_files %> <%= paginate @archive_files %>
</div> </div>
<div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:add), new_panel_archive_back_end_archive_file_path, :class => 'btn btn-primary pull-right' if (is_manager? rescue nil) %>
<div id="web_link_pagination" class="paginationFixed">
<%= paginate @archive_files, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>

View File

@ -1,2 +1,7 @@
$("#collapse-status").html("<%= j render 'filter_status' %>");
$("#collapse-category").html("<%= j render 'filter_categories' %>");
$("#collapse-tags").html("<%= j render 'filter_tags' %>");
$("#delete_all").attr("action", "<%= delete_panel_archive_back_end_archive_files_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]) %>");
$("#sort_headers").html("<%= j render 'sort_headers' %>");
$("#tbody_archive").html("<%= j render :partial => 'archive_file', :collection => @archive_files %>"); $("#tbody_archive").html("<%= j render :partial => 'archive_file', :collection => @archive_files %>");
$("#archive_pagination").html("<%= j paginate @archive_files %>"); $("#archive_file_pagination").html("<%= j paginate @archive_files, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");

View File

@ -1,31 +1,56 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<%= flash_messages %>
<%#= paginate @archive_files, :params => {:inner => false}%> <div class="o-archives layout-table">
<%# if @title %> <table>
<!-- <h1 class="h1"><%#= @title %></h1> --> <thead>
<%# end %> <tr>
<th class="column-ctrl col-title">Title</th>
<!-- <ul class="subm"> --> <th class="column-ctrl col-file">Files</th>
<%# @archive_file_categorys.each do |afcpost| %> <th class="column-ctrl col-category">Category</th>
<!-- <li><%#= link_to afcpost.title, panel_archive_front_end_archive_files_path(:category_id => afcpost.id) %></li> --> </tr>
<%# end %> </thead>
<!-- </ul> --> <tbody>
<h3><%= @current_category.title rescue nil %></h3>
<% @archive_files.each do |post| %>
<%= link_to post.title, panel_archive_front_end_archive_file_path(post, :category_id => post.archive_file_category_id) %>
<% @archive_files.each_with_index do |post,i| %>
<tr <% if ( (i + 1) % 2 ) == 0 %> class="even" <% end %>>
<td><div class="o-archives-title"><%= post.title %></div></td>
<td>
<div class="o-archives-list-item">
<% if !post.archive_file_multiples.blank? %>
<ol> <ol>
<% post.archive_file_multiples.each do | afile | %> <% post.archive_file_multiples.desc("id asc").each do | afile | %>
<% if afile.file.file and afile.choose_lang_display(I18n.locale.to_s) %> <% if afile.file.file and afile.choose_lang_display(I18n.locale.to_s) %>
<li><%= link_to afile.file_title, afile.file.url, {:target => '_blank', :title => afile.file_title} %></li> <li>
<%= link_to afile.file_title, afile.file.url, {:target => '_blank', :title => afile.file_title, :class => "o-archives-file"} %>
<%= post.get_file_icon(afile.file.url) %>
</li>
<% end %> <% end %>
<% end %> <% end %>
</ol> </ol>
<% end %> <% end %>
</div>
</td>
<td><div class="o-archives-category">
<%= post.archive_file_category.title %>
</div></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<%= paginate @archive_files, :param_name => :page_main, :params => {:inner => 'false'} %>
<%= stylesheet_link_tag "archive/archives" %>

View File

@ -0,0 +1,10 @@
<% @bulletins.each do |bulletin| %>
<li>
<%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id , :tag_id => @selected_tag.id ) %>
</li>
<% end %>
<div class='pagination'>
<%= link_to_previous_page @bulletins, 'Previous Page', :params => {:controller => 'widget/bulletins', :action => 'reload_bulletins', :tag_id => @selected_tag.id}, :remote => true, :class => 'previous' %>
<%= link_to_next_page @bulletins, 'Next Page', :params => {:controller => 'widget/bulletins', :action => 'reload_bulletins', :tag_id => @selected_tag.id}, :remote => true, :class => 'next' %>
</div>

View File

@ -0,0 +1,99 @@
<% # encoding: utf-8 %>
<% if @widget_style == '1' %>
<div class="o-archives layout-table">
<table>
<thead>
<tr>
<th class="column-ctrl col-title">Title</th>
<th class="column-ctrl col-file">Files</th>
<th class="column-ctrl col-category">Category</th>
</tr>
</thead>
<tbody>
<% @archive_files.each_with_index do |post,i| %>
<tr <% if ( (i + 1) % 2 ) == 0 %> class="even" <% end %>>
<td><div class="o-archives-title"><%= post.title %></div></td>
<td>
<div class="o-archives-list-item">
<% if !post.archive_file_multiples.blank? %>
<ol>
<% post.archive_file_multiples.desc("id asc").each do | afile | %>
<% if afile.file.file and afile.choose_lang_display(I18n.locale.to_s) %>
<li>
<%= link_to afile.file_title, afile.file.url, {:target => '_blank', :title => afile.file_title, :class => "o-archives-file"} %>
<%= post.get_file_icon(afile.file.url) %>
</li>
<% end %>
<% end %>
</ol>
<% end %>
</div>
</td>
<td><div class="o-archives-category">
<%= post.archive_file_category.title %>
</div></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="pull_right">
<% if !params[:category_id].blank? %>
<%= link_to t('archive.read_more'), panel_archive_front_end_archive_files_path(:category_id => @part.category) %>
<% else %>
<%= link_to t('archive.read_more'), panel_archive_front_end_archive_files_path %>
<% end %>
</div>
<% elsif @widget_style == '2' %>
<div class="o-archives">
<div class="o-archives-content">
<% @archive_file_categorys.each do |afcpost| %>
<div class="o-archives-group">
<% if @category_id.blank? %>
<h2 class="o-archives-category h2"><%= afcpost.title %></h2>
<% end %>
<div class="o-archives-content">
<div class="o-archives-list">
<ul>
<% afcpost.archive_files.can_display.desc( :is_top ).each do |post| %>
<li>
<h3 class="o-archives-title h3"><%= post.title %></h3>
<div class="o-archives-list-item">
<% if !post.archive_file_multiples.blank? %>
<ol>
<% post.archive_file_multiples.desc("_id asc").each do | afile | %>
<% if afile.file.file and afile.choose_lang_display(I18n.locale.to_s) %>
<li>
<%= link_to afile.file_title, afile.file.url, {:target => '_blank', :title => afile.file_title, :class => "o-archives-file"} %>
<%= post.get_file_icon(afile.file.url) %>
</li>
<% end %>
<% end %>
</ol>
<% end %>
</div>
</li>
<% end %>
</ul>
</div>
</div>
<% end %>
</div>
</div>
<% end %>

View File

@ -0,0 +1,3 @@
<li>
<%= link_to tag[I18n.locale], panel_announcement_widget_bulletins_and_web_links_path(:id => tag.id), :remote => true, :class => ('active' if tag.eql?(@selected_tag)) %>
</li>

View File

@ -0,0 +1,10 @@
<% @web_links.each do |web_link| %>
<li>
<%= link_to web_link.title, web_link.url %>
</li>
<% end %>
<div class='pagination'>
<%= link_to_previous_page @web_links, 'Previous Page', :params => {:controller => 'widget/bulletins', :action => 'reload_web_links', :tag_id => @selected_tag.id}, :remote => true, :class => 'previous' %>
<%= link_to_next_page @web_links, 'Next Page', :params => {:controller => 'widget/bulletins', :action => 'reload_web_links', :tag_id => @selected_tag.id}, :remote => true, :class => 'next' %>
</div>

View File

@ -0,0 +1,31 @@
<% # encoding: utf-8 %>
<% if @bulletins and !@bulletins.nil? %>
<div class="tag_block">
<ul class="tag_list">
<% @tags.each do |tag| %>
<li><%= tag[I18n.locale] %></li>
<% end %>
</ul>
</div>
<% @tags.each_with_index do |tag, index| %>
<div id="news_<%= index %>" class="news_block">
<h3 class="news_title2"><%= t("announcement.bulletins") %></h3>
<div class="news_prev">prev</div>
<div class="news_next">next</div>
<ul class="news_list">
<% tag.bulletins.each do |post| %>
<li><%= link_to post.title, panel_announcement_front_end_bulletin_path(post) %></li>
<% end %>
</ul>
</div>
<% end %>
<% end %>

View File

@ -0,0 +1,8 @@
<%= form_tag panel_announcement_front_end_bulletins_path, method: :get do %>
<%= hidden_field_tag :category_id, params[:category_id] %>
<%= hidden_field_tag :tag_id, params[:tag_id] %>
<p>
<%= text_field_tag :search_query, params[:search_query],{:value => (params[:search_query].blank?? '' : params[:search_query]),:placeholder => t("announcement.search") }%>
<%= submit_tag "Search", name: nil %>
</p>
<% end %>

View File

@ -0,0 +1,23 @@
<!-- <div class="search"> <input type="text" onfocus="this.value='';this.searchClickFlag=true;" onblur="if(this.value==''){this.value='公告搜尋';this.searchClickFlag=false;}" value="公告搜尋" id="q" class="search_key" name="q"/> <input type="submit" name="sa" id="sa" class="sa" value="." /> </div> -->
<div class="category_list">
<h3 class="h3"><%= t(:categories) %></h3>
<ul class="list">
<% @bulletin_categorys.each do |category| %>
<li class="<%= category.id.to_s.eql?(params[:category_id]) ? 'active' : nil %>">
<%= link_to category.title, panel_announcement_front_end_bulletins_path(:category_id => category.id) %>
</li>
<% end %>
</ul>
</div>
<div class="tag_cloud">
<h3 class="h3"><%= t(:tag_cloud) %></h3>
<div class="cloud">
<% @tags_and_class.each do |tag| %>
<%= link_to tag[0][I18n.locale], panel_announcement_front_end_bulletins_path(:tag_id => tag[0].id, :category_id => params[:category_id]), :class => "#{tag[1]} #{(tag[0].id.to_s.eql?(params[:tag_id]) || tag[0].key.eql?(params[:tag_id])) ? 'active' : nil} " %>
<% end %>
</div>
</div>
<!-- <div class="clear"></div> -->
<!-- <div class="rss_feed">
<a href="" class="rssimg"> Rss feed </a>
</div> -->

View File

@ -0,0 +1,7 @@
<%= stylesheet_link_tag "default_widget" %>
<script type='text/javascript' src='/assets/jquery.mu.image.resize.js'></script>
<script type='text/javascript' src='/assets/jquery.mu.image.resize.degsin.js'></script>
<div id="archive_file_widget">
<%= render 'index' %>
</div>

View File

@ -0,0 +1 @@
$('#bulletin_widget').html("<%= j render 'index' %>")

View File

@ -0,0 +1 @@
$('#bulletins_web_links_bulletins').html("<%= j render 'bulletins' if @bulletins %>")

View File

@ -0,0 +1 @@
$('#bulletins_web_links_web_links').html("<%= j render 'web_links' if @web_links %>")

View File

@ -7,6 +7,11 @@ en:
archive: archive:
all: All all: All
archive: Archive archive: Archive
widget:
index: Archive Widget
frontend:
archive: Archive Frontend
read_more: Read More
add: Add add: Add
back: Back back: Back
create: Create create: Create

View File

@ -5,9 +5,10 @@ zh_tw:
archive: 檔案室 archive: 檔案室
all: 全部檔案 all: 全部檔案
widget: widget:
archive_files: 檔案室Wiget index: 檔案室Widget
frontend: frontend:
archive: 檔案室前台 archive: 檔案室前台
read_more: 閱讀更多
add: 新增 add: 新增
back: 回去 back: 回去
create: 創造 create: 創造

View File

@ -3,17 +3,19 @@ Rails.application.routes.draw do
namespace :panel do namespace :panel do
namespace :archive do namespace :archive do
namespace :back_end do namespace :back_end do
resources :archive_files resources :archive_files do
collection do
get 'delete'
end
end
resources :archive_file_categorys resources :archive_file_categorys
resources :tags resources :tags
end end
namespace :front_end do namespace :front_end do
root :to => "archive_files#index"
resources :archive_files resources :archive_files
end end
namespace :widget do namespace :widget do
match "archive_files" => "archive_files#index" match "index" => "archive_files#index"
match "reload_archive_files" => "archive_files#reload_archive_files"
end end
end end
end end

View File

@ -3,7 +3,7 @@ module Archive
module_label 'archive.archive' module_label 'archive.archive'
base_url File.expand_path File.dirname(__FILE__) base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/archive/plugin/profile",:i18n=>'archive.archive' # personal_plugin :enable => true,:path=>"panel/archive/plugin/profile",:i18n=>'archive.archive'
version "0.1" version "0.1"
organization "Rulingcom" organization "Rulingcom"
@ -17,20 +17,28 @@ module Archive
end end
end end
category ["ArchiveFileCategory"]
widgets do widgets do
# default_widget do # default_widget do
# query 'Bulletin.all' # query 'ArchiveFile.all'
# image :image # field :category
# link_field :title,{:method => 'panel_archive_front_end_archive_file_path',:args=>:self}
# link_field :archive_file_category_with_title,{:method => 'panel_archive_front_end_archive_files_path',:args=>{:category_id => [:archive_file_category,:id]}}
# end # end
# categories_query 'BulletinCategory.all' categories_query 'ArchiveFileCategory.all'
# tags_query 'ArchiveTag.all' tags_query 'ArchiveTag.all'
customize_widget "archive_files" do
widget_i18n "archive.widget.archive_files" customize_widget "index" do
style [] widget_i18n "archive.widget.index"
style ["1"]
end end
# item "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"]
# item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links"
end end
side_bar do side_bar do
head_label_i18n 'archive.archive',:icon_class=>"icons-archive" head_label_i18n 'archive.archive',:icon_class=>"icons-archive"
available_for [:admin,:guest,:manager,:sub_manager] available_for [:admin,:guest,:manager,:sub_manager]

View File

@ -1,5 +1,7 @@
zh_tw: zh_tw:
_locale: "中文" _locale: "中文"
module_name:
personal_conference: 研討會論文
personal_conference: personal_conference:
year : "年度" year : "年度"
language : "語言" language : "語言"

View File

@ -6,7 +6,7 @@
</td> </td>
<td class="span1"><%= diploma.start_date.strftime("%Y.%m") %> ~ <%= diploma.end_date.strftime("%Y.%m") %></td> <td class="span1"><%= diploma.start_date.strftime("%Y.%m") %> ~ <%= diploma.end_date.strftime("%Y.%m") %></td>
<td class="span1"> <td class="span1">
<%= link_to diploma.school_name, panel_personal_diploma_front_end_diploma_path(diploma) %> <%= diploma.school_name %>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
<%if at_least_module_manager || diploma.diploma_category.cur_user_is_sub_manager_of(:edit)%> <%if at_least_module_manager || diploma.diploma_category.cur_user_is_sub_manager_of(:edit)%>

View File

@ -6,7 +6,7 @@
</td> </td>
<td class="span1"><%= experience.start_date.strftime("%Y.%m") %> ~ <%= experience.end_date.strftime("%Y.%m") %></td> <td class="span1"><%= experience.start_date.strftime("%Y.%m") %> ~ <%= experience.end_date.strftime("%Y.%m") %></td>
<td class="span1"> <td class="span1">
<%= link_to experience.organizationt_title, panel_personal_experience_front_end_experience_path(experience) %> <%= experience.organizationt_title %>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
<%if at_least_module_manager || experience.experience_category.cur_user_is_sub_manager_of(:edit)%> <%if at_least_module_manager || experience.experience_category.cur_user_is_sub_manager_of(:edit)%>