calendar agenda view update

This commit is contained in:
devin 2012-10-27 00:11:26 +08:00
parent 2c5539eda9
commit 12b7618cc7
60 changed files with 253 additions and 2184 deletions

View File

@ -169,14 +169,43 @@
#calendar_agenda .table { #calendar_agenda .table {
margin-bottom: 0; margin-bottom: 0;
} }
#calendar_agenda .tiny_calendar {
border: solid 1px #eee;
}
#calendar_agenda .tiny_calendar .table th {
border-top: 0;
}
#calendar_agenda .tiny_calendar .table td {
text-align: center;
}
#calendar_agenda .event { #calendar_agenda .event {
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
box-shadow: none; box-shadow: none;
} }
#calendar_agenda .row-fluid {
margin-top: 20px;
padding-top: 20px;
border-top: dashed 1px #ddd;
}
#calendar_agenda .row-fluid:first-child {
border-top: 0;
padding-top: 0;
margin-top: 0;
}
#calendar_agenda .table.event_list .span2, #calendar_agenda .table.event_list thead th {
min-height: 0 !important;
height: 0 !important;
line-height: 0;
padding: 0;
}
.event_time { .event_time {
font-family: Tahoma, sans-serif; font-family: Tahoma, sans-serif;
} }
.has_event {
background-color: #08c;
color: #fff;
}
/* day view */ /* day view */
#calendar_day .header { #calendar_day .header {

View File

@ -1,7 +1,70 @@
<div id="calendar_agenda"> <div id="calendar_agenda">
<div class="row-fluid">
<div class="span3">
<h4>September</h4>
<div class="tiny_calendar">
<table class="table"> <table class="table">
<thead>
<tr> <tr>
<th class="week_title">Sun</th>
<th class="week_title">Mon</th>
<th class="week_title">Tue</th>
<th class="week_title">Wed</th>
<th class="week_title">Thu</th>
<th class="week_title">Fri</th>
<th class="week_title">Sat</th>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
<tr>
<td>10</td>
<td>11</td>
<td>12</td>
<td class="has_event">13</td>
<td>14</td>
<td>15</td>
<td>16</td>
</tr>
<tr>
<td>17</td>
<td>18</td>
<td>19</td>
<td>20</td>
<td>21</td>
<td>22</td>
<td>23</td>
</tr>
<tr>
<td>24</td>
<td>25</td>
<td>26</td>
<td>27</td>
<td>28</td>
<td>29</td>
<td>30</td>
</tr>
</table>
</div>
</div>
<div class="span9">
<table class="table event_list">
<thead>
<tr height="0">
<th class="span2"></th> <th class="span2"></th>
<th class="span2"></th> <th class="span2"></th>
<th class=""></th> <th class=""></th>
@ -45,223 +108,118 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
<!-- <div id="calendar_week">
<table class="table header">
<tr>
<th style="width: 44px;"></th>
<th>Sun 9/11</th>
<th>Mon 9/12</th>
<th class="today">Tue 9/13</th>
<th>Wed 9/14</th>
<th>Thu 9/15</th>
<th>Fri 9/16</th>
<th>Sat 9/17</th>
</tr>
<tr>
<td colspan="8" style="border:0;">
<div class="event_list_wrapper" style="height:50px;">
<table style="position: absolute; width: 100%; height: 50px; top: 0;">
<tr>
<td style="border: 0; background: none; width: 60px;"></td>
<td class="all_day_event week_day"></td>
<td class="all_day_event week_day"></td>
<td class="all_day_event week_day"></td>
<td class="all_day_event week_day"></td>
<td class="all_day_event week_day"></td>
<td class="all_day_event week_day"></td>
<td class="all_day_event week_day"></td>
</tr>
</table>
<table class="all_day_event_holder">
<tr>
<td rowspan="2" style="width:60px;"></td>
<td colspan="7" class="all_day_event week_day">
<div class="event half" style="background-color: #ccffee;">
<dl>
<dt>10:30am - template</dt>
<dd></dd>
</dl>
</div> </div>
</td>
</tr>
<tr>
<td colspan="1"></td>
<td colspan="2" class="all_day_event week_day">
<div class="event half" style="background-color: #ccffee;">
<dl>
<dt>10:30am - template</dt>
<dd></dd>
</dl>
</div> </div>
</td> <div class="row-fluid">
<td colspan="4"></td> <div class="span3">
</tr> <h4>October</h4>
</table> <div class="tiny_calendar">
tiny calendar goes here
</div> </div>
</td> </div>
</tr> <div class="span9">
</table> <table class="table event_list">
<div class="event_list"> <thead>
<table class="table cell_map">
<tr height="0"> <tr height="0">
<td style="width: 60px;"></td> <th class="span2"></th>
<td colspan="7"> <th class="span2"></th>
<div class="event_list_wrapper"> <th class=""></th>
<div class="cell_wrapper"> </tr>
<div class="cell"> </thead>
<div class="divide"></div> <tbody>
</div> <tr>
<div class="cell"> <th>Thu, Sep 6</th>
<div class="divide"></div> <td class="event_time">9:00am - 9:30am</td>
</div> <td>
<div class="cell"> <div class="event" style="color: #ffcc00;">Commuting time, from home to RD</div>
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
</div>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<th></th>
<td class="event_time">9:30am - 12:00am</td>
<td> <td>
<div class="day_time">12am</div> <div class="event" style="color: #ffcc00;">Work on Thu project, and ask ika for help if possible</div>
<div class="day_time">1am</div>
<div class="day_time">2am</div>
<div class="day_time">3am</div>
<div class="day_time">4am</div>
<div class="day_time">5am</div>
<div class="day_time">6am</div>
<div class="day_time">7am</div>
<div class="day_time">8am</div>
<div class="day_time">9am</div>
<div class="day_time">10am</div>
<div class="day_time">11am</div>
<div class="day_time">12am</div>
<div class="day_time">1pm</div>
<div class="day_time">2pm</div>
<div class="day_time">3pm</div>
<div class="day_time">4pm</div>
<div class="day_time">5pm</div>
<div class="day_time">6pm</div>
<div class="day_time">7pm</div>
<div class="day_time">8pm</div>
<div class="day_time">9pm</div>
<div class="day_time">10pm</div>
<div class="day_time">11pm</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<td class="week_day today">
<div class="event_holder">
<div class="inner">
<div class="event" style="background-color: #ccffee; top: 117px;">
<dl>
<dt>10:30am - 11:00am</dt>
<dd>template</dd>
</dl>
</div>
</div>
</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td> </td>
</tr> </tr>
<tr>
<th></th>
<td class="event_time">13:30pm - 18:00pm</td>
<td>
<div class="event" style="color: #ffcc00;">Template design, at least finish 2 template</div>
</td>
</tr>
<tr>
<th>Fri, Sep 7</th>
<td class="event_time">9:00am - 18:00pm</td>
<td>
<div class="event" style="color: #ddee00;">Take a day off</div>
</td>
</tr>
<tr>
<th>Sat, Sep 8</th>
<td class="event_time">7:00am - 7:50pm</td>
<td>
<div class="event" style="color: #00ddee;">Work out with Joseph</div>
</td>
</tr>
</tbody>
</table> </table>
</div> </div>
</div>
<div class="row-fluid">
<div class="span3">
<h4>November</h4>
<div class="tiny_calendar">
tiny calendar goes here
</div>
</div>
<div class="span9">
<table class="table event_list">
<thead>
<tr height="0">
<th class="span2"></th>
<th class="span2"></th>
<th class=""></th>
</tr>
</thead>
<tbody>
<tr>
<th>Thu, Sep 6</th>
<td class="event_time">9:00am - 9:30am</td>
<td>
<div class="event" style="color: #ffcc00;">Commuting time, from home to RD</div>
</td>
</tr>
<tr>
<th></th>
<td class="event_time">9:30am - 12:00am</td>
<td>
<div class="event" style="color: #ffcc00;">Work on Thu project, and ask ika for help if possible</div>
</td>
</tr>
<tr>
<th></th>
<td class="event_time">13:30pm - 18:00pm</td>
<td>
<div class="event" style="color: #ffcc00;">Template design, at least finish 2 template</div>
</td>
</tr>
<tr>
<th>Fri, Sep 7</th>
<td class="event_time">9:00am - 18:00pm</td>
<td>
<div class="event" style="color: #ddee00;">Take a day off</div>
</td>
</tr>
<tr>
<th>Sat, Sep 8</th>
<td class="event_time">7:00am - 7:50pm</td>
<td>
<div class="event" style="color: #00ddee;">Work out with Joseph</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div> </div>
-->

View File

@ -1,6 +1,6 @@
<%= stylesheet_link_tag "font-awesome" %> <%= stylesheet_link_tag "font-awesome" %>
<%= stylesheet_link_tag "calendar" %>
<%= stylesheet_link_tag "bootstrap-responsive" %> <%= stylesheet_link_tag "bootstrap-responsive" %>
<%= stylesheet_link_tag "calendar" %>
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "calendarAPI" %> <%= javascript_include_tag "calendarAPI" %>
<% end %> <% end %>

View File

@ -1,23 +0,0 @@
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_locale
# Set I18n.locale
def set_locale
# update session if passed
session[:locale] = params[:locale] if params[:locale]
# set locale based on session or default
begin
# check if locale is valid for non site pages
if !VALID_LOCALES.include?(session[:locale])
I18n.locale = I18n.default_locale
else
I18n.locale = session[:locale]
end
rescue
I18n.locale = I18n.default_locale
end
end
end

View File

@ -1,8 +0,0 @@
class Panel::PersonalPatent::BackEnd::TagsController < Admin::TagsController
def initialize
super
@app_title = 'personal_patent'
end
end

View File

@ -1,119 +0,0 @@
class Panel::PersonalPatent::BackEnd::WritingPatentCategorysController < OrbitBackendController
include OrbitControllerLib::DivisionForDisable
before_filter :force_order_for_visitor,:only=>[:index,:show]
before_filter :force_order_for_user,:except => [:index,:show]
before_filter :for_app_manager,:except => [:index]
def index
@writing_patent_categorys = WritingPatentCategory.all
@writing_patent_category = WritingPatentCategory.new(:display => 'List')
@url = panel_personal_patent_back_end_writing_patent_categorys_path
respond_to do |format|
format.html # index.html.erb
format.js
end
end
# GET /projects/1
# GET /projects/1.xml
def show
@writing_patent_category = WritingPatentCategory.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.js
end
end
# GET /projects/new
# GET /projects/new.xml
def new
@writing_patent_category = WritingPatentCategory.new(:display => 'List')
@verb = :post
respond_to do |format|
format.html # new.html.erb
format.js
end
end
# GET /projects/1/edit
def edit
@writing_patent_category = WritingPatentCategory.find(params[:id])
@url = panel_personal_patent_back_end_writing_patent_category_path(@writing_patent_category)
@verb = :put
respond_to do |format|
format.html
format.js
end
end
# POST /projects
# POST /projects.xml
def create
@writing_patent_category = WritingPatentCategory.new(params[:writing_patent_category])
respond_to do |format|
if @writing_patent_category.save
format.html { redirect_to(panel_personal_patent_back_end_writing_patent_categorys_url, :notice => t('writing_patent_category.create_writing_patent_category_success')) }
format.js
else
format.html { render :action => "new" }
format.js { render action: "new" }
end
end
end
# PUT /projects/1
# PUT /projects/1.xml
def update
@writing_patent_category = WritingPatentCategory.find(params[:id])
# debugger
@url = panel_personal_patent_back_end_writing_patent_category_path(@writing_patent_category)
respond_to do |format|
if @writing_patent_category.update_attributes(params[:writing_patent_category])
format.html { redirect_to(panel_personal_patent_back_end_writing_patent_categorys_url, :notice => t('writing_patent_category.update_writing_patent_category_success')) }
# format.xml { head :ok }
format.js
else
format.html { render :action => "edit" }
format.js { render :action => "edit" }
end
end
end
# DELETE /projects/1
# DELETE /projects/1.xml
def destroy
@writing_patent_category = WritingPatentCategory.find(params[:id])
@writing_patent_category.disable = @writing_patent_category.disable ? false : true
if @writing_patent_category.save!
respond_to do |format|
format.html { redirect_to(panel_personal_patent_back_end_writing_patent_categorys_url) }
# format.xml { head :ok }
format.js
end
else
flash[:error] = t("writing_patent_category.update_failed")
format.html { render :action => "index" }
end
end
end

View File

@ -1,244 +0,0 @@
class Panel::PersonalPatent::BackEnd::WritingPatentsController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user!
before_filter :force_order_for_visitor,:only=>[:index,:show]
before_filter :force_order_for_user,:except => [:index,:show]
# before_filter :for_app_manager,:except => [:index,:show]
before_filter :only => [ :new,:create,:edit,:update,:create] do |controller|
controller.get_categorys('WritingPatentCategory')
end
def index
get_categorys("WritingPatentCategory",params[:writing_patent_category_id])
@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
@writing_patent_categorys = get_categories_for_index("WritingPatentCategory")
@writing_patent_category_ids = @writing_patent_categorys.collect{|t| t.id.to_s} + [nil]
@writing_patents = (params[:sort] || @filter) ? get_sorted_and_filtered("writing_patent",:writing_patent_category_id.in => @writing_patent_category_ids) : get_viewable("writing_patent",:writing_patent_category_id.in => @writing_patent_category_ids)
get_tags
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @writing_patents }
format.js
end
end
def writing_patent_setting
@writing_patent_categorys = WritingPatentCategory.all
get_tags
@set_writing_patent_category = WritingPatentCategory.new(:display => 'List')
@writing_patent_category_url = panel_personal_patent_back_end_writing_patents_path
end
def writing_patent_category_quick_add
@set_writing_patent_category = WritingPatentCategory.new(:display => 'List')
@writing_patent_category_url = panel_personal_patent_back_end_writing_patents_path
@set_writing_patent_category.id = params[:id]
respond_to do |format|
format.js
end
end
def writing_patent_category_quick_edit
@set_writing_patent_category = WritingPatentCategory.find(params[:writing_patent_id])
@writing_patent_category_url = panel_personal_patent_back_end_writing_patent_path(@set_writing_patent_category)
respond_to do |format|
format.js
end
end
# GET /writing_patents/1
# GET /writing_patents/1.xml
def show
@writing_patent = WritingPatent.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @writing_patent }
end
end
# GET /writing_patents/new
# GET /writing_patents/new.xml
def new
@writing_patent = WritingPatent.new
debugger
@writing_patent_categorys = WritingPatentCategory.all
get_tags
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @writing_patent }
end
end
# GET /writing_patents/1/edit
def edit
@writing_patent = WritingPatent.find(params[:id])
@writing_patent_categorys = WritingPatentCategory.all
get_tags
end
# POST /writing_patents
# POST /writing_patents.xml
def create
if params[:writing_patent_category]
@writing_patent_category = WritingPatentCategory.new(params[:writing_patent_category])
respond_to do |format|
if @writing_patent_category.save
format.js { render 'create_writing_patent_setting' }
end
end
else
@writing_patent_categorys = WritingPatentCategory.all
get_tags
@writing_patent = WritingPatent.new(params[:writing_patent])
@writing_patent.create_user_id = current_user.id
@writing_patent.update_user_id = current_user.id
respond_to do |format|
if @writing_patent.save
format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) }
format.xml { render :xml => @writing_patent, :status => :created, :location => @writing_patent }
else
format.html { render :action => "new" }
format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity }
end
end
end
end
# PUT /writing_patents/1
# PUT /writing_patents/1.xml
def update
if params[:writing_patent_category]
@writing_patent_category = WritingPatentCategory.find(params[:id])
respond_to do |format|
if @writing_patent_category.update_attributes(params[:writing_patent_category])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_writing_patent_setting' }
end
end
else
@writing_patent = WritingPatent.find(params[:id])
@writing_patent.update_user_id = current_user.id
params[:writing_patent][:tag_ids] ||=[]
respond_to do |format|
if @writing_patent.update_attributes(params[:writing_patent])
format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity }
end
end
end
end
# DELETE /writing_patents/1
# DELETE /writing_patents/1.xml
def destroy
@writing_patent = WritingPatent.find(params[:id])
@writing_patent.destroy
respond_to do |format|
format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) }
# format.xml { head :ok }
format.js
end
end
def delete
if params[:ids]
writing_patents = WritingPatent.any_in(:_id => params[:ids]).delete_all
end
redirect_to panel_personal_patent_back_end_writing_patents_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
protected
# def get_index_categories(id = nil)
# @bulletin_categorys = []
# if(is_manager? || is_admin?)
# @bulletin_categorys = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all)
# elsif is_sub_manager?
# @bulletin_categorys = BulletinCategory.all
# end
# @bulletin_categorys
# end
# def get_categorys(id = nil)
# @writing_patent_categorys = []
# if(is_manager? || is_admin?)
# @writing_patent_categorys = (id ? WritingPatent.admin_manager_all.find(id).to_a : WritingPatent.admin_manager_all))
# elsif is_sub_manager?
# @writing_patent_categorys = WritingPatent.all.authed_for_user(current_user,'edit')
# end
# if @writing_patent_categorys.empty? && params[:action] != "index"
# flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
# redirect_to :action => :index
# end
# end
def get_tags
module_app = ModuleApp.first(:conditions => {:key => 'personal_patent'})
@tags = Tag.all(:conditions => {:module_app_id => module_app.id})
end
end

View File

@ -1,244 +0,0 @@
class Panel::PersonalPatent::BackEnd::WritingPatentsController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user!
before_filter :force_order_for_visitor,:only=>[:index,:show]
before_filter :force_order_for_user,:except => [:index,:show]
# before_filter :for_app_manager,:except => [:index,:show]
before_filter :only => [ :new,:create,:edit,:update,:create] do |controller|
controller.get_categorys('WritingPatentCategory')
end
def index
get_categorys("WritingPatentCategory",params[:writing_patent_writing_patent_category_id])
@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
@writing_patent_categorys = get_categories_for_index("WritingPatentCategory")
@writing_patent_category_ids = @writing_patent_categorys.collect{|t| t.id.to_s} + [nil]
@writing_patents = (params[:sort] || @filter) ? get_sorted_and_filtered("writing_patent",:writing_patent_category_id.in => @writing_patent_category_ids) : get_viewable("writing_patent",:writing_patent_category_id.in => @writing_patent_category_ids)
get_tags
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @writing_patents }
format.js
end
end
def writing_patent_setting
@writing_patent_categorys = WritingPatentCategory.all
get_tags
@set_writing_patent_category = WritingPatentCategory.new(:display => 'List')
@writing_patent_category_url = panel_personal_patent_back_end_writing_patents_path
end
def writing_patent_category_quick_add
@set_writing_patent_category = WritingPatentCategory.new(:display => 'List')
@writing_patent_category_url = panel_personal_patent_back_end_writing_patents_path
@set_writing_patent_category.id = params[:id]
respond_to do |format|
format.js
end
end
def writing_patent_category_quick_edit
@set_writing_patent_category = WritingPatentCategory.find(params[:writing_patent_id])
@writing_patent_category_url = panel_personal_patent_back_end_writing_patent_path(@set_writing_patent_category)
respond_to do |format|
format.js
end
end
# GET /writing_patents/1
# GET /writing_patents/1.xml
def show
@writing_patent = Project.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @writing_patent }
end
end
# GET /writing_patents/new
# GET /writing_patents/new.xml
def new
@writing_patent = Project.new
@writing_patent_categorys = WritingPatentCategory.all
get_tags
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @writing_patent }
end
end
# GET /writing_patents/1/edit
def edit
@writing_patent = Project.find(params[:id])
@writing_patent_categorys = WritingPatentCategory.all
get_tags
end
# POST /writing_patents
# POST /writing_patents.xml
def create
if params[:writing_patent_category]
@writing_patent_category = WritingPatentCategory.new(params[:writing_patent_category])
respond_to do |format|
if @writing_patent_category.save
format.js { render 'create_writing_patent_setting' }
end
end
else
@writing_patent_categorys = WritingPatentCategory.all
get_tags
@writing_patent = Project.new(params[:writing_patent])
@writing_patent.create_user_id = current_user.id
@writing_patent.update_user_id = current_user.id
respond_to do |format|
if @writing_patent.save
format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) }
format.xml { render :xml => @writing_patent, :status => :created, :location => @writing_patent }
else
format.html { render :action => "new" }
format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity }
end
end
end
end
# PUT /writing_patents/1
# PUT /writing_patents/1.xml
def update
if params[:writing_patent_category]
@writing_patent_category = WritingPatentCategory.find(params[:id])
respond_to do |format|
if @writing_patent_category.update_attributes(params[:writing_patent_category])
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
format.js { render 'update_writing_patent_setting' }
end
end
else
@writing_patent = Project.find(params[:id])
@writing_patent.update_user_id = current_user.id
params[:writing_patent][:tag_ids] ||=[]
respond_to do |format|
if @writing_patent.update_attributes(params[:writing_patent])
format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity }
end
end
end
end
# DELETE /writing_patents/1
# DELETE /writing_patents/1.xml
def destroy
@writing_patent = Project.find(params[:id])
@writing_patent.destroy
respond_to do |format|
format.html { redirect_to(panel_personal_patent_back_end_writing_patents_url) }
# format.xml { head :ok }
format.js
end
end
def delete
if params[:ids]
writing_patents = Project.any_in(:_id => params[:ids]).delete_all
end
redirect_to panel_personal_patent_back_end_writing_patents_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
protected
# def get_index_categories(id = nil)
# @bulletin_categorys = []
# if(is_manager? || is_admin?)
# @bulletin_categorys = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all)
# elsif is_sub_manager?
# @bulletin_categorys = BulletinCategory.all
# end
# @bulletin_categorys
# end
# def get_categorys(id = nil)
# @writing_patent_categorys = []
# if(is_manager? || is_admin?)
# @writing_patent_categorys = (id ? Project.admin_manager_all.find(id).to_a : Project.admin_manager_all))
# elsif is_sub_manager?
# @writing_patent_categorys = Project.all.authed_for_user(current_user,'edit')
# end
# if @writing_patent_categorys.empty? && params[:action] != "index"
# flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
# redirect_to :action => :index
# end
# end
def get_tags
module_app = ModuleApp.first(:conditions => {:key => 'personal_patent'})
@tags = Tag.all(:conditions => {:module_app_id => module_app.id})
end
end

View File

@ -1,181 +0,0 @@
class Panel::PersonalPatent::Plugin::WritingPatentsController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user!
before_filter :force_order_for_visitor,:only=>[:index,:show]
before_filter :force_order_for_user,:except => [:index,:show]
# before_filter :for_app_manager,:except => [:index,:show]
before_filter :only => [ :new,:create,:edit,:update,:create] do |controller|
controller.get_categorys('WritingPatentCategory')
end
def index
get_categorys("WritingPatentCategory",params[:writing_patent_writing_patent_category_id])
@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
@writing_patent_categorys = get_categories_for_index("WritingPatentCategory")
@writing_patent_category_ids = @writing_patent_categories.collect{|t| t.id.to_s} + [nil]
@writing_patents = (params[:sort] || @filter) ? get_sorted_and_filtered("writing_patent",:create_user_id => current_user.id) : get_viewable("writing_patent", :create_user_id => current_user.id)
get_tags
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @writing_patents }
format.js
end
end
# GET /writing_patents/1
# GET /writing_patents/1.xml
def show
@writing_patent = Project.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @writing_patent }
end
end
# GET /writing_patents/new
# GET /writing_patents/new.xml
def new
@writing_patent = Project.new
@writing_patent_categorys = WritingPatentCategory.all
get_tags
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @writing_patent }
end
end
# GET /writing_patents/1/edit
def edit
@writing_patent = Project.find(params[:id])
@writing_patent_categorys = WritingPatentCategory.all
get_tags
end
# POST /writing_patents
# POST /writing_patents.xml
def create
@writing_patent_categorys = WritingPatentCategory.all
get_tags
@writing_patent = Project.new(params[:writing_patent])
@writing_patent.create_user_id = current_user.id
@writing_patent.update_user_id = current_user.id
respond_to do |format|
if @writing_patent.save
format.html { redirect_to(panel_personal_writing_patent_plugin_writing_patents_url) }
format.xml { render :xml => @writing_patent, :status => :created, :location => @writing_patent }
else
format.html { render :action => "new" }
format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity }
end
end
end
# PUT /writing_patents/1
# PUT /writing_patents/1.xml
def update
@writing_patent = Project.find(params[:id])
@writing_patent.update_user_id = current_user.id
params[:writing_patent][:tag_ids] ||=[]
respond_to do |format|
if @writing_patent.update_attributes(params[:writing_patent])
format.html { redirect_to(panel_personal_writing_patent_plugin_writing_patents_url) }
# format.js { render 'toggle_enable' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @writing_patent.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /writing_patents/1
# DELETE /writing_patents/1.xml
def destroy
@writing_patent = Project.find(params[:id])
@writing_patent.destroy
respond_to do |format|
format.html { redirect_to(panel_personal_writing_patent_plugin_writing_patents_url) }
# format.xml { head :ok }
format.js
end
end
def delete
if params[:ids]
writing_patents = Project.any_in(:_id => params[:ids]).delete_all
end
redirect_to panel_personal_writing_patent_plugin_writing_patents_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
protected
# def get_index_categories(id = nil)
# @bulletin_categorys = []
# if(is_manager? || is_admin?)
# @bulletin_categorys = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all)
# elsif is_sub_manager?
# @bulletin_categorys = BulletinCategory.all
# end
# @bulletin_categorys
# end
# def get_categorys(id = nil)
# @writing_patent_categorys = []
# if(is_manager? || is_admin?)
# @writing_patent_categorys = (id ? Project.admin_manager_all.find(id).to_a : Project.admin_manager_all))
# elsif is_sub_manager?
# @writing_patent_categorys = Project.all.authed_for_user(current_user,'edit')
# end
# if @writing_patent_categorys.empty? && params[:action] != "index"
# flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
# redirect_to :action => :index
# end
# end
def get_tags
module_app = ModuleApp.first(:conditions => {:key => 'personal_patent'})
@tags = Tag.all(:conditions => {:module_app_id => module_app.id})
end
end

View File

@ -1,9 +0,0 @@
class PersonalPatentTag < Tag
has_and_belongs_to_many :writing_patents
def get_visible_links(sort = :title)
self.writing_patents.where(:is_hidden => false).desc(:is_top, sort)
end
end

View File

@ -1,108 +0,0 @@
# encoding: utf-8
class WritingPatent
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
# scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
LANGUAGE_TYPES = [ "English", "Chinese" ]
field :patent_title, localize: true
field :authors, localize: true
has_and_belongs_to_many :tags, :class_name => "PersonalPatentTag"
belongs_to :writing_patent_category
field :year
field :language
field :keywords
field :patent_no
field :patent_country
field :publish_date , :type => Date
field :url
field :note
field :create_user_id
field :update_user_id
# field :is_top, :type => Boolean, :default => false
# field :is_hot, :type => Boolean, :default => false
# field :is_hidden, :type => Boolean, :default => false
has_many :writing_patent_files, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :writing_patent_files, :allow_destroy => true
# before_save :update_avliable_language, :clean_checkboxs
validates :writing_patent_title, :at_least_one => true
before_validation :add_http
after_save :save_writing_patent_files
validates :url, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix, :unless => Proc.new{self.url.blank?}
def self.search( category_id = nil )
if category_id.to_s.size > 0
find(:all, :conditions => {writing_patent_category_id: category_id}).desc( :is_top, :title )
else
find(:all).desc( :is_top, :title)
end
end
def self.widget_datas
where( :is_hidden => false ).desc(:is_top, :created_at)
end
def is_top?
self.is_top
end
def sorted_tags
tags.order_by(I18n.locale, :asc)
end
def update_avliable_language
VALID_LOCALES.each do |locale|
if (title_translations[locale].blank? rescue true)
self["available_for_#{locale}".to_sym] = false
else
self["available_for_#{locale}".to_sym] = true
end
end
end
def save_writing_patent_files
self.writing_patent_files.each do |t|
if t.should_destroy
t.destroy
end
end
end
protected
def add_http
unless self.url.blank? || self.url[/^http:\/\//] || self.url[/^https:\/\//]
self.url = 'http://' + self.url
end
end
def clean_checkboxs
self.tag_ids.delete('')
end
end

View File

@ -1,28 +0,0 @@
# encoding: utf-8
class WritingPatentCategory
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCoreLib::ObjectAuthable
include OrbitCoreLib::ObjectDisable
# include Mongoid::MultiParameterAttributes
AfterObjectAuthUrl = '/panel/personal_patent/back_end/writing_patent_categorys'
APP_NAME = 'project'
# ObjectAuthTitlesOptions = %W{edit}
ObjectAuthTitlesOptions = %W{submit_new fact_check}
field :key
field :title, localize: true
has_many :writing_patents
def pp_object
title
end
def self.from_id(id)
WritingPatentCategory.find(id) rescue nil
end
end

View File

@ -1,14 +0,0 @@
class WritingPatentFile
include Mongoid::Document
include Mongoid::Timestamps
mount_uploader :file, AssetUploader
# field :description, localize: true
field :should_destroy, :type => Boolean
field :title, localize: true
belongs_to :writing_patent
end

View File

@ -1,30 +0,0 @@
<% # encoding: utf-8 %>
<%= form_for(@writing_patent_category, :remote => true, :url => @url) do |f| %>
<h2><%= (@writing_patent_category.new_record? ? 'Add' : 'Edit') %></h2>
<div id="widget-title">
<%= f.label :key %>
<%= f.text_field :key %>
</div>
<div id="widget-title">
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'input-xxlarge', :value => (@web_link_category.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="form-actions">
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
</div>
<% end %>

View File

@ -1,16 +0,0 @@
<tr id="<%= dom_id writing_patent_category %>" class="with_action">
<td>
<%= writing_patent_category.key %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('writing_patent_category.edit'), edit_panel_personal_patent_back_end_writing_patent_category_path(writing_patent_category), :remote => true %></li>
<li><%= link_to t('writing_patent_category.delete'), panel_personal_patent_back_end_writing_patent_category_path(writing_patent_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
</ul>
</div>
</td>
<% @site_valid_locales.each do |locale| %>
<td><%= writing_patent_category.title_translations[locale] %></td>
<% end %>
</tr>

View File

@ -1,2 +0,0 @@
$('<%= j render :partial => 'writing_patent_category', :collection => [@writing_patent_category] %>').appendTo('#writing_patent_categorys').hide().fadeIn();
$("#new_writing_patent_category")[0].reset();

View File

@ -1 +0,0 @@
$("#<%= dom_id @writing_patent_category %>").remove();

View File

@ -1 +0,0 @@
$("#form > form").replaceWith("<%= j render "form" %>");

View File

@ -1,23 +0,0 @@
<%= flash_messages %>
<table id="writing_patent_categorys" class="table main-list">
<thead>
<tr>
<th class="span1-2"><%= t('writing_patent_category.key') %></th>
<% @site_valid_locales.each do |locale| %>
<th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<% end %>
</tr>
</thead>
<tbody>
<%= render :partial => 'writing_patent_category', :collection => @writing_patent_categorys %>
</tbody>
</table>
<div id="form"><%= render :partial => "form" %></div>

View File

@ -1 +0,0 @@
$("#form > form").replaceWith("<%= j render "form" %>");

View File

@ -1,4 +0,0 @@
$("#<%= dom_id @writing_patent_category %>").replaceWith("<%= j render :partial => 'link_category', :collection => [@writing_patent_category] %>");
<% @writing_patent_category = ProjectCategory.new(:display => 'List') # reset for new form %>
$(".edit_writing_patent_category").replaceWith("<%= j render "form" %>")
$(".new_writing_patent_category")[0].reset();

View File

@ -1,11 +0,0 @@
<div id="filter" class="subnav">
<div class="filters">
<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

@ -1,209 +0,0 @@
<% # encoding: utf-8 %>
<%= f.error_messages %>
<!--Widget start-->
<div id="sub-wiget">
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear">
<a class="action"><i title="Setting" class="icon-cog icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag icons-white"></i>Tags</h3>
<div class="widget-content clear form-horizontal">
<% @tags.each do |tag| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_patent[tag_ids][]', tag.id, @writing_patent.tag_ids.include?(tag.id)%>
<%= tag[I18n.locale] %>
<%= hidden_field_tag 'writing_patent[tag_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<div id="post-body">
<div id="post-body-content" class="clear">
<div class="title">
<%= f.label :year ,t("personal_patent.year")%>
<%= select_year((@writing_patent.year ? @writing_patent.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_patent[year]'} ) %>
</div>
<div class="title">
<%= f.label :writing_patent_category ,t("personal_patent.writing_patent_category")%>
<%= f.select :writing_patent_category_id, @writing_patent_categorys.collect {|t| [ t.title, t.id ]} %>
</div>
<div class="title">
<%= f.label :period_start_date ,t("personal_patent.period_start_date")%>
<%= f.date_select :period_start_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %>
</div>
<div class="title">
<%= f.label :period_end_date ,t("personal_patent.period_end_date")%>
<%= f.date_select :period_end_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %>
</div>
<ul class="nav nav-tabs">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<div class="title">
<%= f.label :writing_patent_title ,t("personal_patent.writing_patent_title")%>
<%= f.fields_for :writing_patent_title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.writing_patent_title_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :job_title ,t("personal_patent.job_title")%>
<%= f.fields_for :job_title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.job_title_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :participator ,t("personal_patent.participator")%>
<%= f.fields_for :participator_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.participator_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :unit ,t("personal_patent.unit")%>
<%= f.fields_for :unit_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.unit_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<% end %>
</div>
<div class="title">
<%= f.label :url, t("personal_patent.url") %>
<%= f.text_field :url %>
</div>
<div class="title">
<%= f.label :keywords, t("personal_patent.keywords") %>
<%= f.text_field :keywords %>
</div>
<div class="title">
<%= f.label :abstract, t("personal_patent.abstract") %>
<%= f.text_field :abstract %>
</div>
<div id="title">
<%= f.label :language, t("personal_patent.language") %>
<%= f.radio_button :language, "Chinese" %> <%= t("personal_patent.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_patent.English") %>
</div>
<div class="title">
<%= f.label :note, t("personal_patent.note") %>
<%= f.text_area :note, :size => "60x3" %>
</div>
</div>
<div>
<div id='plugin_files' class="plugin_files_block">
<table class="table table-condensed">
<thead>
<tr>
<th>File</th>
<th>File Name</th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="3">
<div id='add_plugin_file' class="info_input plugin_files_block">
<%= hidden_field_tag 'plugin_file_field_count', @writing_patent.writing_patent_files.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a>
</div>
</td>
</tr>
</tfoot>
<tbody>
<% @writing_patent.writing_patent_files.each_with_index do |writing_patent_file, i| %>
<%= f.fields_for :writing_patent_files, writing_patent_file do |f| %>
<%= render :partial => 'form_file', :object => writing_patent_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<!--Post End-->
<div class="form-actions">
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "archive_plugin_form" %>
<script>
$('#add_plugin_file a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_add_plugin_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_patent_files) %>").replace(old_id, new_id));
});
$('.add_plugin_files_block a.delete').live('click', function(){
$(this).parents('.list_item').remove();
});
$('.action a.remove_existing_record').live('click', function(){
$(this).next('.should_destroy').attr('value', 1);
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
});
</script>
<% end %>

View File

@ -1,50 +0,0 @@
<% # encoding: utf-8 %>
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'>
<td>
<div class="control-group">
<div class="controls">
<%= f.file_field :file %>
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
</div>
</div>
</td>
<td>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<%#= f.fields_for :i18n_variable, (form_file.new_record? ? form_file.build_i18n_variable : form_file.i18n_variable ) do |f| %>
<%= f.fields_for :file_title_translations do |f| %>
<div class="control-group">
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.from_locale(locale) %></label>
<div class="controls">
<%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
</td>
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
</td>
</tr>

View File

@ -1,11 +0,0 @@
<% # encoding: utf-8 %>
<tr id="<%= dom_id list_writing_patent_category %>">
<td><%= list_writing_patent_category.title %></td>
<td class="span2">
<a href="<%= panel_personal_patent_back_end_writing_patent_writing_patent_category_quick_edit_path(list_writing_patent_category) %>#myModal1" data-toggle="modal" data-remote="true" class="action"><%= t('edit')%></a>
<%= link_to show_toggle_archive_btn(list_writing_patent_category),
polymorphic_path([:panel, :personal_patent, :back_end, list_writing_patent_category]), :confirm => t('announcement.sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
</td>
</tr>

View File

@ -1,8 +0,0 @@
<%= render_sort_bar(true, delete_panel_personal_patent_back_end_writing_patents_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
['publish_date', 'publish_date', 'span1', 'writing_patent.publish_date'],
['patent_title', 'patent_title','span3', 'writing_patent.patent_title'],
['patent_no', 'patent_no','span3', 'writing_patent.patent_no'],
['patent_country', 'patent_country','span3', 'writing_patent.patent_country'],
['authors', 'authors','span3', 'writing_patent.authors'],
['url', 'url','span3', 'writing_patent.url'],
['create_modified', 'create_user_id','span1-3', 'writing_patent.create_modified']).html_safe %>

View File

@ -1,25 +0,0 @@
<tr id="<%= dom_id writing_patent %>" class="with_action">
<td>
<% if (writing_patent.create_user_id == current_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', writing_patent.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td><%= writing_patent.publish_date.strftime("%Y.%m") %></td>
<td>
<%= link_to writing_patent.patent_title, panel_personal_patent_front_end_writing_patent_path(writing_patent) %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<%if at_least_module_manager || writing_patent.writing_patent_category.cur_user_is_sub_manager_of(:edit)%>
<li><%= link_to t('edit'), edit_panel_personal_patent_back_end_writing_patent_path(writing_patent) %></li>
<li><%= link_to t('delete'), panel_personal_patent_back_end_writing_patent_path(writing_patent), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
<% end -%>
</ul>
</div>
</td>
<td><%= writing_patent.patent_no %></td>
<td><%= writing_patent.patent_country %></td>
<td><%= writing_patent.authors %></td>
<td><%= writing_patent.url %></td>
<td><%= User.from_id(writing_patent.create_user_id).name rescue ''%></td>
</tr>

View File

@ -1,34 +0,0 @@
<% # encoding: utf-8 %>
<%= form_for(@set_writing_patent_category, :remote => true, :url => @writing_patent_category_url ) do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabe1"><%= (@set_writing_patent_category.new_record? ? 'Add 專利類別' : 'Edit 專利類別') %></h3>
</div>
<div class="modal-body">
<div class="control-group">
<label for="http" class="control-label">Key</label>
<div class="controls">
<%= f.text_field :key %>
</div>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'control-label', :value => (@set_writing_patent_category.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
<div class="modal-footer">
<%= hidden_field_tag 'writing_patent_category[writing_patent_category]', @set_writing_patent_category.id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>
<% end %>

View File

@ -1,5 +0,0 @@
<% if !@writing_patent_category.blank? %>
$("#myModal1").modal('hide');
$('<%= j render :partial => 'list_writing_patent_category', :collection => [@writing_patent_category] %>').appendTo('#writing_patent_categorys').hide().fadeIn();
<% end %>

View File

@ -1 +0,0 @@
$("#<%= dom_id @writing_patent %>").remove();

View File

@ -1,5 +0,0 @@
<h1><%= t('personal_patent.editing_personal_patent') %></h1>
<%= form_for @writing_patent, :url => panel_personal_patent_back_end_writing_patent_path(@writing_patent), :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>

View File

@ -1,22 +0,0 @@
<%= render 'filter' %>
<table class="table main-list">
<thead>
<tr>
<th class="span1"></th>
<th class="span1"></th>
<th class="span2"></th>
<th class="span3"></th>
<th class="span2"></th>
</tr>
</thead>
<tbody id="tbody_writing_patents" class="sort-holder">
<%= render :partial => 'writing_patent', :collection => @writing_patents %>
</tbody>
</table>
<div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_patent_back_end_writing_patent_path, :class => 'btn btn-primary pull-right' %>
<div id="writing_patent_pagination" class="paginationFixed">
<%= paginate @writing_patents, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>

View File

@ -1,3 +0,0 @@
$("#sort_headers").html("<%= j render 'sort_headers' %>");
$("#tbody_writing_patents").html("<%= j render :partial => 'writing_patent', :collection => @writing_patents %>");
$("#writing_patent_pagination").html("<%= j paginate @writing_patents, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");

View File

@ -1,10 +0,0 @@
<%= flash_messages %>
<div id="poststuff">
<h1><%= t('writing_patent.new_personal_patent') %></h1>
<%= form_for @writing_patent, :url => panel_personal_patent_back_end_writing_patents_path, :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
</div>
<%#= link_back %>

View File

@ -1,3 +0,0 @@
$("#enable_<%= @bulletin.id %>").toggle();
$("#disable_<%= @bulletin.id %>").toggle();
$("#bulletin_<%= @bulletin.id %>").toggleClass('disable');

View File

@ -1,5 +0,0 @@
<% if !@writing_patent_category.blank? %>
$("#myModal1").modal('hide');
$("#<%= dom_id @writing_patent_category %>").replaceWith("<%= j render :partial => 'list_writing_patent_category', :collection => [@writing_patent_category] %>");
<% end %>

View File

@ -1 +0,0 @@
$("#myModal1").html("<%= j render "writing_patent_category_qe" %>");

View File

@ -1 +0,0 @@
$("#myModal1").html("<%= j render "writing_patent_category_qe" %>");

View File

@ -1,113 +0,0 @@
<% # encoding: utf-8 %>
<div id="isotope">
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<a class="btn btn-small btn-primary pull-right" href="<%= panel_personal_patent_back_end_writing_patent_writing_patent_category_quick_add_path('add') %>#myModal1" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
<span>專利類別</span>
</p>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table id="writing_patent_categorys" class="table table-striped">
<tbody>
<%= render :partial => 'list_writing_patent_category', :collection => @writing_patent_categorys %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<div class="detail w-a h-a">
<p class="totle">
<button class="btn btn-small btn-primary pull-right" type="button" data-toggle="modal" data-target="#myModal4"><i class="icon-plus"></i> 新增</button>
<span>領域</span>
</p>
<ul class="nav nav-tabs">
<li class="active"><a href="#">中文</a></li>
<li><a href="#">English</a></li>
</ul>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Corresponding Author</td>
<td>編輯 刪除</td>
</tr>
<tr>
<td>First Author, Co- Authors</td>
<td>編輯 刪除</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-actions form-fixed pagination-right">
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯出</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 匯入</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 新增</a>&nbsp;
<a class="btn btn-primary pull-right" href><i class="icon-plus icon-white"></i> 設定</a> 
</div>
<div id="writing_patent_category_qe">
<div style="display:none;" class="modal" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<%= render :partial => "writing_patent_category_qe" %>
</div>
</div>
<div style="display:none;" class="modal" id="myModal4" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">領域</h3>
</div>
<ul class="nav nav-tabs">
<li class="active"><a href="#">中文</a></li>
<li><a href="#">English</a></li>
</ul>
<div class="modal-body">
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputvalue">名稱</label>
<div class="controls">
<input type="text" id="inputvalue" placeholder="Value">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "item" %>
<% end %>

View File

@ -1,11 +0,0 @@
<div id="filter" class="subnav">
<div class="filters">
<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

@ -1,209 +0,0 @@
<% # encoding: utf-8 %>
<%= f.error_messages %>
<!--Widget start-->
<div id="sub-wiget">
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear">
<a class="action"><i title="Setting" class="icon-cog icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag icons-white"></i>Tags</h3>
<div class="widget-content clear form-horizontal">
<% @tags.each do |tag| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'writing_patent[tag_ids][]', tag.id, @writing_patent.tag_ids.include?(tag.id)%>
<%= tag[I18n.locale] %>
<%= hidden_field_tag 'writing_patent[tag_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<div id="post-body">
<div id="post-body-content" class="clear">
<div class="title">
<%= f.label :year ,t("personal_patent.year")%>
<%= select_year((@writing_patent.year ? @writing_patent.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_patent[year]'} ) %>
</div>
<div class="title">
<%= f.label :writing_patent_category ,t("personal_patent.writing_patent_category")%>
<%= f.select :writing_patent_category_id, @writing_patent_categorys.collect {|t| [ t.title, t.id ]} %>
</div>
<div class="title">
<%= f.label :period_start_date ,t("personal_patent.period_start_date")%>
<%= f.date_select :period_start_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %>
</div>
<div class="title">
<%= f.label :period_end_date ,t("personal_patent.period_end_date")%>
<%= f.date_select :period_end_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %>
</div>
<ul class="nav nav-tabs">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<div class="title">
<%= f.label :writing_patent_title ,t("personal_patent.writing_patent_title")%>
<%= f.fields_for :writing_patent_title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.writing_patent_title_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :job_title ,t("personal_patent.job_title")%>
<%= f.fields_for :job_title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.job_title_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :participator ,t("personal_patent.participator")%>
<%= f.fields_for :participator_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.participator_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="title">
<%= f.label :unit ,t("personal_patent.unit")%>
<%= f.fields_for :unit_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.unit_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<% end %>
</div>
<div class="title">
<%= f.label :url, t("personal_patent.url") %>
<%= f.text_field :url %>
</div>
<div class="title">
<%= f.label :keywords, t("personal_patent.keywords") %>
<%= f.text_field :keywords %>
</div>
<div class="title">
<%= f.label :abstract, t("personal_patent.abstract") %>
<%= f.text_field :abstract %>
</div>
<div id="title">
<%= f.label :language, t("personal_patent.language") %>
<%= f.radio_button :language, "Chinese" %> <%= t("personal_patent.Chinese") %>
<%= f.radio_button :language, "English" %> <%= t("personal_patent.English") %>
</div>
<div class="title">
<%= f.label :note, t("personal_patent.note") %>
<%= f.text_area :note, :size => "60x3" %>
</div>
</div>
<div>
<div id='plugin_files' class="plugin_files_block">
<table class="table table-condensed">
<thead>
<tr>
<th>File</th>
<th>File Name</th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="3">
<div id='add_plugin_file' class="info_input plugin_files_block">
<%= hidden_field_tag 'plugin_file_field_count', @writing_patent.writing_patent_files.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a>
</div>
</td>
</tr>
</tfoot>
<tbody>
<% @writing_patent.writing_patent_files.each_with_index do |writing_patent_file, i| %>
<%= f.fields_for :writing_patent_files, writing_patent_file do |f| %>
<%= render :partial => 'form_file', :object => writing_patent_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<!--Post End-->
<div class="form-actions">
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "archive_plugin_form" %>
<script>
$('#add_plugin_file a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_add_plugin_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :writing_patent_files) %>").replace(old_id, new_id));
});
$('.add_plugin_files_block a.delete').live('click', function(){
$(this).parents('.list_item').remove();
});
$('.action a.remove_existing_record').live('click', function(){
$(this).next('.should_destroy').attr('value', 1);
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
});
</script>
<% end %>

View File

@ -1,50 +0,0 @@
<% # encoding: utf-8 %>
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'>
<td>
<div class="control-group">
<div class="controls">
<%= f.file_field :file %>
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
</div>
</div>
</td>
<td>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<%#= f.fields_for :i18n_variable, (form_file.new_record? ? form_file.build_i18n_variable : form_file.i18n_variable ) do |f| %>
<%= f.fields_for :file_title_translations do |f| %>
<div class="control-group">
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.from_locale(locale) %></label>
<div class="controls">
<%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
</td>
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
</td>
</tr>

View File

@ -1,7 +0,0 @@
<%= render_sort_bar(true, delete_panel_personal_patent_back_end_writing_patents_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
['publish_date', 'publish_date', 'span1', 'writing_patent.publish_date'],
['patent_title', 'patent_title','span3', 'writing_patent.patent_title'],
['patent_no', 'patent_no','span3', 'writing_patent.patent_no'],
['patent_country', 'patent_country','span3', 'writing_patent.patent_country'],
['authors', 'authors','span3', 'writing_patent.authors'],
['url', 'url','span3', 'writing_patent.url']).html_safe %>

View File

@ -1,24 +0,0 @@
<tr id="<%= dom_id writing_patent %>" class="with_action">
<td>
<% if (writing_patent.create_user_id == current_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', writing_patent.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
<td><%= writing_patent.period_start_date.strftime("%Y.%m") %> ~ <%= writing_patent.period_end_date.strftime("%Y.%m") %></td>
<td>
<%= link_to writing_patent.writing_patent_title, panel_personal_patent_front_end_writing_patent_path(writing_patent) %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<%if at_least_module_manager || writing_patent.writing_patent_category.cur_user_is_sub_manager_of(:edit)%>
<li><%= link_to t('edit'), edit_panel_personal_patent_plugin_writing_patent_path(writing_patent) %></li>
<li><%= link_to t('delete'), panel_personal_patent_plugin_writing_patent_path(writing_patent), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
<% end -%>
</ul>
</div>
</td>
<td><%= writing_patent.participator %></td>
<td><%= writing_patent.job_title %></td>
<td><%= writing_patent.unit %></td>
<td><%= User.from_id(writing_patent.create_user_id).name rescue ''%></td>
</tr>

View File

@ -1 +0,0 @@
$("#<%= dom_id @writing_patent %>").remove();

View File

@ -1,5 +0,0 @@
<h1><%= t('personal_patent.editing_personal_patent') %></h1>
<%= form_for @writing_patent, :url => panel_personal_patent_plugin_writing_patent_path(@writing_patent), :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>

View File

@ -1,22 +0,0 @@
<%= render 'filter' %>
<table class="table main-list">
<thead>
<tr>
<th class="span1"></th>
<th class="span1"></th>
<th class="span2"></th>
<th class="span3"></th>
<th class="span2"></th>
</tr>
</thead>
<tbody id="tbody_writing_patents" class="sort-holder">
<%= render :partial => 'writing_patent', :collection => @writing_patents %>
</tbody>
</table>
<div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_patent_plugin_writing_patent_path, :class => 'btn btn-primary pull-right' %>
<div id="writing_patent_pagination" class="paginationFixed">
<%= paginate @writing_patents, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
</div>
</div>

View File

@ -1,3 +0,0 @@
$("#sort_headers").html("<%= j render 'sort_headers' %>");
$("#tbody_writing_patents").html("<%= j render :partial => 'writing_patent', :collection => @writing_patents %>");
$("#writing_patent_pagination").html("<%= j paginate @writing_patents, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");

View File

@ -1,10 +0,0 @@
<%= flash_messages %>
<div id="poststuff">
<h1><%= t('writing_patent.new_personal_patent') %></h1>
<%= form_for @writing_patent, :url => panel_personal_patent_plugin_writing_patents_path, :html => {:class => 'clear'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
</div>
<%#= link_back %>

View File

@ -1,3 +0,0 @@
$("#enable_<%= @bulletin.id %>").toggle();
$("#disable_<%= @bulletin.id %>").toggle();
$("#bulletin_<%= @bulletin.id %>").toggleClass('disable');