Finished
This commit is contained in:
parent
b81db3b5ae
commit
26aa8217bb
|
@ -0,0 +1,88 @@
|
|||
class Admin::ResearchsController < OrbitMemberController
|
||||
layout "member_plugin"
|
||||
|
||||
before_action :set_plugin
|
||||
before_action :get_settings,:only => [:new, :edit, :setting]
|
||||
|
||||
def index
|
||||
@researchs = Research.all
|
||||
end
|
||||
|
||||
def new
|
||||
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
|
||||
@research = Research.new
|
||||
end
|
||||
|
||||
def create
|
||||
@member = MemberProfile.find(research_params['member_profile_id']) rescue nil
|
||||
@research = Research.new(research_params)
|
||||
@research.save
|
||||
redirect_to '/admin/members/'+@member.to_param+'/Research'
|
||||
end
|
||||
|
||||
def edit
|
||||
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
|
||||
@research = Research.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@member = MemberProfile.find(research_params['member_profile_id']) rescue nil
|
||||
@research = Research.find(params[:id])
|
||||
@research.update_attributes(research_params)
|
||||
@research.save
|
||||
redirect_to '/admin/members/'+@member.to_param+'/Research'
|
||||
end
|
||||
|
||||
def destroy
|
||||
@research = Research.find(params[:id])
|
||||
@research.destroy
|
||||
end
|
||||
|
||||
def toggle_hide
|
||||
if params[:ids]
|
||||
@researchs = Research.any_in(_id: params[:ids])
|
||||
|
||||
@researchs.each do |research|
|
||||
research.is_hidden = params[:disable]
|
||||
research.save
|
||||
end
|
||||
end
|
||||
|
||||
render json: {"success"=>true}
|
||||
end
|
||||
|
||||
def setting
|
||||
end
|
||||
|
||||
def frontend_setting
|
||||
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
|
||||
@intro = ResearchIntro.find_by(:member_profile_id=>@member.id) rescue nil
|
||||
@intro = @intro.nil? ? ResearchIntro.new({:member_profile_id=>@member.id}) : @intro
|
||||
end
|
||||
|
||||
def update_frontend_setting
|
||||
@member = MemberProfile.find(intro_params['member_profile_id']) rescue nil
|
||||
@intro = ResearchIntro.find_by(:member_profile_id=>@member.id) rescue nil
|
||||
@intro = @intro.nil? ? ResearchIntro.new({:member_profile_id=>@member.id}) : @intro
|
||||
@intro.update_attributes(intro_params)
|
||||
@intro.save
|
||||
redirect_to '/admin/members/'+@member.to_param+'/Research'
|
||||
end
|
||||
|
||||
def get_settings
|
||||
end
|
||||
|
||||
def set_plugin
|
||||
@plugin = OrbitApp::Plugin::Registration.all.select{|plugin| plugin.app_name.eql? 'Research'}.first
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def research_params
|
||||
params.require(:research).permit! rescue nil
|
||||
end
|
||||
|
||||
def intro_params
|
||||
params.require(:research_intro).permit! rescue nil
|
||||
end
|
||||
end
|
|
@ -0,0 +1,65 @@
|
|||
class PersonalResearchesController < ApplicationController
|
||||
def index
|
||||
researchs = Research.where(:is_hidden=>false).all
|
||||
research_list = researchs.collect do |research|
|
||||
{
|
||||
"member" => research.member_profile.name,
|
||||
"year" => research.year,
|
||||
"publication_date" => research.publish_date.strftime("%Y.%m"),
|
||||
"research_title" => research.research_title,
|
||||
"link_to_show" => OrbitHelper.url_to_show(research.to_param)
|
||||
}
|
||||
end
|
||||
{
|
||||
"researchs" => research_list,
|
||||
"extras" => {
|
||||
"widget-title" => t("module_name.personal_research"),
|
||||
"th_member" => t('users.name'),
|
||||
"th_year" => t('personal_research.year'),
|
||||
"th_publication_date" => t('personal_research.publication_date'),
|
||||
"th_research_title" => t('personal_research.research_title'),
|
||||
"th_detail" => t('detail')
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def show
|
||||
params = OrbitHelper.params
|
||||
research = Research.where(:is_hidden=>false).find_by(uid: params[:uid])
|
||||
|
||||
files = research.research_files.map do |file|
|
||||
{
|
||||
"file_url" => file.file.url,
|
||||
"file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title),
|
||||
"file_ext" => File.extname(file.file.path).sub('.',''),
|
||||
"file_description" => file.description
|
||||
}
|
||||
end
|
||||
|
||||
{
|
||||
"files" => files,
|
||||
"data" => {
|
||||
"research_title" => research.research_title,
|
||||
"authors" => research.authors,
|
||||
"extracted_chapters" => research.extracted_chapters,
|
||||
"year" => research.year,
|
||||
"language" => t(research.language),
|
||||
"publish_date" => research.publish_date.strftime("%Y.%m"),
|
||||
"keywords" => research.keywords,
|
||||
"url" => research.url,
|
||||
"note" => research.note,
|
||||
|
||||
"th_research_title" => t("personal_research.research_title"),
|
||||
"th_authors" => t("personal_research.authors"),
|
||||
"th_extracted_chapters" => t("personal_research.extracted_chapters"),
|
||||
"th_year" => t("personal_research.year"),
|
||||
"th_language" => t("personal_research.language"),
|
||||
"th_publish_date" => t("personal_research.publication_date"),
|
||||
"th_keywords" => t("personal_research.keywords"),
|
||||
"th_url" => t("personal_research.url"),
|
||||
"th_note" => t("personal_research.note"),
|
||||
"th_files" => t(:file_)
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
|
@ -0,0 +1,38 @@
|
|||
class Research
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitModel::Status
|
||||
include Slug
|
||||
|
||||
belongs_to :member_profile
|
||||
|
||||
field :research_title, as: :slug_title, localize: true
|
||||
field :authors, localize: true
|
||||
field :extracted_chapters, localize: true
|
||||
|
||||
field :year
|
||||
field :language
|
||||
field :publish_date , :type => Date
|
||||
field :keywords
|
||||
field :url
|
||||
field :note
|
||||
field :create_user_id, :type => BSON::ObjectId
|
||||
field :update_user_id, :type => BSON::ObjectId
|
||||
|
||||
paginates_per 10
|
||||
|
||||
has_many :research_files, :autosave => true, :dependent => :destroy
|
||||
|
||||
accepts_nested_attributes_for :research_files, :allow_destroy => true
|
||||
|
||||
before_validation :add_http
|
||||
|
||||
protected
|
||||
|
||||
def add_http
|
||||
unless self.url.blank? || self.url[/^http:\/\//] || self.url[/^https:\/\//]
|
||||
self.url = 'http://' + self.url
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
class ResearchFile
|
||||
|
||||
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 :research
|
||||
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
class ResearchIntro < PersonalPluginIntro
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1,228 @@
|
|||
<% # encoding: utf-8 %>
|
||||
<% content_for :page_specific_css do %>
|
||||
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||
<%= stylesheet_link_tag "lib/fileupload" %>
|
||||
<%= stylesheet_link_tag "lib/main-list" %>
|
||||
<% end %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
||||
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
||||
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
||||
<%= javascript_include_tag "lib/file-type" %>
|
||||
<%= javascript_include_tag "lib/module-area" %>
|
||||
<% end %>
|
||||
|
||||
<!-- Input Area -->
|
||||
<div class="input-area">
|
||||
|
||||
<!-- Module Tabs -->
|
||||
<div class="nav-name"><strong><%= t(:module) %></strong></div>
|
||||
<ul class="nav nav-pills module-nav">
|
||||
<li></li>
|
||||
<li class="active">
|
||||
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Module -->
|
||||
<div class="tab-content module-area">
|
||||
|
||||
<!-- Basic Module -->
|
||||
<div class="tab-pane fade in active" id="basic">
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
|
||||
<div class="controls">
|
||||
<%= @member.name rescue ''%>
|
||||
<%= f.hidden_field :member_profile_id, :value => @member.id %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- year -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_research.year") %></label>
|
||||
<div class="controls">
|
||||
<%= select_year((@research.year ? @research.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'research[year]',:class => 'span1'} ) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- publish_date -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_research.publication_date") %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :publish_date, :no_label => true, :format=>"yyyy/MM" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- keywords -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_research.keywords") %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :keywords %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- language -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_research.language") %></label>
|
||||
<div class="controls">
|
||||
<select id="research" name="research[language]">
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<option value="<%= locale %>" <%= @research.language.eql?(locale.to_s) ? "selected" : ""%>><%= t(locale) %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- url -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_research.url") %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :url , :class => "span6" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- note -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_research.note") %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Status Module -->
|
||||
<div class="tab-pane fade" id="status">
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:status) %></label>
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<label class="checkbox inline btn <%= 'active' if @research.is_hidden? %>">
|
||||
<%= f.check_box :is_hidden %> <%= t(:hide) %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Language Tabs -->
|
||||
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
||||
<ul class="nav nav-pills language-nav">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<li class="<%= 'active' if i == 0 %>">
|
||||
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<!-- Language -->
|
||||
<div class="tab-content language-area">
|
||||
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<!-- research_title-->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t("personal_research.research_title") %></label>
|
||||
<div class="controls">
|
||||
<%= f.fields_for :research_title_translations do |f| %>
|
||||
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_research.research_title"), value: (@research.research_title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- extracted_chapters-->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t("personal_research.extracted_chapters") %></label>
|
||||
<div class="controls">
|
||||
<%= f.fields_for :extracted_chapters_translations do |f| %>
|
||||
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_research.extracted_chapters"), value: (@research.extracted_chapters_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- authors-->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t("personal_research.authors") %></label>
|
||||
<div class="controls">
|
||||
<%= f.fields_for :authors_translations do |f| %>
|
||||
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_research.authors"), value: (@research.authors_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<!-- File -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:file_) %></label>
|
||||
<div class="controls">
|
||||
|
||||
<!-- Exist -->
|
||||
<% if @research && !@research.research_files.blank? %>
|
||||
<div class="exist">
|
||||
<% @research.research_files.each_with_index do |research_file, i| %>
|
||||
<%= f.fields_for :research_files, research_file do |f| %>
|
||||
<%= render :partial => 'form_file', :object => research_file, :locals => {:f => f, :i => i} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<hr>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- Add -->
|
||||
<div class="add-target">
|
||||
</div>
|
||||
<p class="add-btn">
|
||||
<%= hidden_field_tag 'plugin_file_field_count', @research.research_files.count %>
|
||||
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Form Actions -->
|
||||
<div class="form-actions">
|
||||
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.main-forms .add-on').tooltip();
|
||||
$(document).on('click', '#add_file', function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_research_files", "g");
|
||||
var on = $('.language-nav li.active').index();
|
||||
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :research_files) %>").replace(old_id, new_id));
|
||||
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
|
||||
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
||||
});
|
||||
formTip();
|
||||
});
|
||||
$(document).on('click', '.delete_file', function(){
|
||||
$(this).parents('.input-prepend').remove();
|
||||
});
|
||||
$(document).on('click', '.remove_existing_record', function(){
|
||||
if(confirm("<%= I18n.t(:sure?)%>")){
|
||||
$(this).children('.should_destroy').attr('value', 1);
|
||||
$(this).parents('.start-line').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
|
@ -0,0 +1,55 @@
|
|||
<% if form_file.new_record? %>
|
||||
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
|
||||
<% else %>
|
||||
<div class="fileupload fileupload-exist start-line" data-provides="fileupload">
|
||||
<% if form_file.file.blank? %>
|
||||
<%= t(:no_file) %>
|
||||
<% else %>
|
||||
<%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="input-prepend input-append">
|
||||
<label>
|
||||
<span class="add-on btn btn-file" title='<%= t(:file_) %>'>
|
||||
<i class="icons-paperclip"></i>
|
||||
<%= f.file_field :file %>
|
||||
</span>
|
||||
<div class="uneditable-input input-medium">
|
||||
<i class="icon-file fileupload-exists"></i>
|
||||
<span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
|
||||
</div>
|
||||
</label>
|
||||
<span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
|
||||
<span class="tab-content">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
</span>
|
||||
<span class="add-on icons-pencil" title='<%= t(:description) %>'></span>
|
||||
<span class="tab-content">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
|
||||
<%= f.fields_for :description_translations do |f| %>
|
||||
<%= f.text_field locale, :class => "input-medium", placeholder: t(:description), :value => (form_file.description_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
</span>
|
||||
</span>
|
||||
<% if form_file.new_record? %>
|
||||
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
|
||||
<a class="icon-trash"></a>
|
||||
</span>
|
||||
<% else %>
|
||||
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
|
||||
<%= f.hidden_field :id %>
|
||||
<a class="icon-remove"></a>
|
||||
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,16 @@
|
|||
<% @researchs.each do |research| %>
|
||||
<tr id="<%= dom_id research %>" class="<%= research.is_hidden ? "checkHide" : "" %>">
|
||||
<td><%= research.year %></td>
|
||||
<td><%= research.publish_date.strftime("%Y.%m") %></td>
|
||||
<td>
|
||||
<%= link_to research.research_title, OrbitHelper.url_to_plugin_show(research.to_param,'personal_research'), target: "blank"%>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><%= link_to t('edit'), '/admin/members/'+research.member_profile.to_param+'/researchs/'+research.id+'/edit' %></li>
|
||||
<li><%= link_to t(:delete_), admin_research_path(id: research.id, member_profile_id: research.member_profile.id), method: :delete, remote: true, data: { confirm: t('sure?') } %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= research.member_profile.name %></td>
|
||||
</tr>
|
||||
<% end %>
|
|
@ -0,0 +1 @@
|
|||
$('#research_<%= @research.id.to_s%>').remove();
|
|
@ -0,0 +1,5 @@
|
|||
<%= form_for @research, url:'/admin/researchs/'+@research.id.to_s, html: {class: "form-horizontal main-forms previewable"} do |f| %>
|
||||
<fieldset>
|
||||
<%= render partial: 'form', locals: {f: f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
|
@ -0,0 +1,93 @@
|
|||
<% content_for :page_specific_css do %>
|
||||
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||
<%= stylesheet_link_tag "lib/main-list" %>
|
||||
<% end %>
|
||||
|
||||
<%= form_for(:research_intro, :url => update_frontend_setting_admin_researchs_path, :method => "post", html: {class: "form-horizontal main-forms previewable"} ) do |f| %>
|
||||
<fieldset>
|
||||
<!-- Input Area -->
|
||||
<div class="input-area">
|
||||
|
||||
<!-- Module Tabs -->
|
||||
<div class="nav-name"><strong><%= t("module_name.personal_research") %></strong></div>
|
||||
<ul class="nav nav-pills module-nav">
|
||||
<li></li>
|
||||
<li class="active">
|
||||
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Module -->
|
||||
<div class="tab-content module-area">
|
||||
<!-- Basic Module -->
|
||||
<div class="tab-pane fade in active" id="basic">
|
||||
<% if !@member.blank? %>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
|
||||
<div class="controls">
|
||||
<%= @member.name rescue ''%>
|
||||
<%= f.hidden_field :member_profile_id, :value => @member.id %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- frontend_page -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_plugins.frontend_page") %></label>
|
||||
<div class="controls">
|
||||
<%= f.check_box :brief_intro, :checked => @intro.brief_intro %> <%= t("personal_plugins.brief_intro") %>
|
||||
<%= f.check_box :complete_list, :checked => @intro.complete_list %> <%= t("personal_plugins.complete_list") %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Language Tabs -->
|
||||
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
||||
<ul class="nav nav-pills language-nav">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<li class="<%= 'active' if i == 0 %>">
|
||||
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<!-- Language -->
|
||||
<div class="tab-content language-area">
|
||||
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<!-- Content -->
|
||||
<div class="control-group input-content">
|
||||
<label class="control-label muted"><%= t(:content) %></label>
|
||||
<div class="controls">
|
||||
<div class="textarea">
|
||||
<%= f.fields_for :text_translations do |f| %>
|
||||
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@intro.text_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Form Actions -->
|
||||
<div class="form-actions">
|
||||
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
|
@ -0,0 +1,13 @@
|
|||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1"><%= t('personal_research.year') %></th>
|
||||
<th class="span1"><%= t('personal_research.publication_date') %></th>
|
||||
<th class="span5"><%= t('personal_research.research_title') %></th>
|
||||
<th class="span3"><%= t('users.name') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_researchs" class="sort-holder">
|
||||
<%= render :partial => 'research', :collection => @researchs %>
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,5 @@
|
|||
<%= form_for @research, url: admin_researchs_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
|
||||
<fieldset>
|
||||
<%= render partial: 'form', locals: {f: f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
|
@ -0,0 +1,18 @@
|
|||
<style type="text/css">
|
||||
.element{
|
||||
background: #FFF;
|
||||
margin-bottom: 10px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #DDD;
|
||||
}
|
||||
.detail{
|
||||
padding: 10px;
|
||||
min-height: 250px;
|
||||
}
|
||||
.totle{
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
.totle span{
|
||||
font-size: 18px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1 @@
|
|||
<%= render_view %>
|
|
@ -0,0 +1 @@
|
|||
<%= render_view %>
|
|
@ -0,0 +1,84 @@
|
|||
<% content_for :page_specific_css do %>
|
||||
<%= stylesheet_link_tag "lib/list-check" %>
|
||||
<% end %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "lib/list-check" %>
|
||||
<% end %>
|
||||
|
||||
<%
|
||||
is_autorized_user = (current_user==@member.user || current_user.is_admin?)
|
||||
if is_autorized_user
|
||||
@researchs = Research.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
|
||||
else
|
||||
@researchs = Research.where(is_hidden: false, member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
|
||||
end
|
||||
%>
|
||||
|
||||
<% if is_autorized_user %>
|
||||
<div class="list-active">
|
||||
<div class="btn-group">
|
||||
<%= link_to('Hide', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-hide", :rel => toggle_hide_admin_researchs_path(member_profile_id: params[:id], disable: 'true') ) %>
|
||||
<%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => toggle_hide_admin_researchs_path(member_profile_id: params[:id], disable: 'false') ) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
||||
<table class="table table-condensed table-striped main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<% if is_autorized_user %>
|
||||
<th><input type="checkbox" /></th>
|
||||
<% end -%>
|
||||
<th class="span2"><%= t('personal_research.year') %></th>
|
||||
<th class="span2"><%= t('personal_research.publication_date') %></th>
|
||||
<th class="span8"><%= t('personal_research.research_title') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @researchs.each do |research| %>
|
||||
<tr id="<%= dom_id research %>" class="<%= research.is_hidden ? "checkHide" : "" %>">
|
||||
<% if is_autorized_user %>
|
||||
<td>
|
||||
<%= check_box_tag 'to_change[]', research.id.to_s, false, :class => "list-check" %>
|
||||
</td>
|
||||
<% end %>
|
||||
<td><%= research.year %></td>
|
||||
<td><%= research.publish_date.strftime("%Y.%m") %></td>
|
||||
<td>
|
||||
<%= link_to research.research_title, OrbitHelper.url_to_plugin_show(research.to_param,'personal_research'), target: "blank"%>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><%= link_to t('edit'), '/admin/members/'+@member.to_param+'/researchs/'+research.id+'/edit' %></li>
|
||||
<li><%= link_to t(:delete_), admin_research_path(id: research.id, member_profile_id: @member.id), method: :delete, remote: true, data: { confirm: t('sure?') } %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<div class="bottomnav clearfix">
|
||||
<% if is_autorized_user %>
|
||||
<div class="action pull-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-edit') +' '+ t('setting'),'/admin/members/'+@member.to_param+'/researchs/frontend_setting', :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'),
|
||||
'/admin/members/'+@member.to_param+'/researchs/new', :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= paginate @researchs, :params => {:direction => params[:direction], :sort => params[:sort] } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3><%= t(:sure?) %></h3>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
|
||||
<button class="delete-item btn btn-danger"><%= t(:submit) %></button>
|
||||
</div>
|
||||
</div>
|
|
@ -2,6 +2,27 @@ Rails.application.routes.draw do
|
|||
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
|
||||
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||
namespace :admin do
|
||||
get 'research_setting' => "researchs#setting"
|
||||
|
||||
resources :researchs do
|
||||
collection do
|
||||
get 'toggle_hide' => 'researchs#toggle_hide'
|
||||
end
|
||||
end
|
||||
|
||||
resources :members do
|
||||
collection do
|
||||
scope '(:name-:uid)' do
|
||||
resources :researchs do
|
||||
collection do
|
||||
get 'frontend_setting' => 'researchs#frontend_setting'
|
||||
post 'update_frontend_setting' => 'researchs#update_frontend_setting'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,13 +4,15 @@ module PersonalResearch
|
|||
OrbitApp.registration "PersonalResearch",:type=> 'ModuleApp' do
|
||||
module_label 'module_name.personal_research'
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
personal_plugin :enable => true, :sort_number => '20', :app_name=>"Research", :intro_app_name=>"PersonalResearchIntro",:path=>"/plugin/profile",:front_path=>"/profile",:admin_path=>"/admin/researches",:i18n=>'module_name.personal_research'
|
||||
personal_plugin :enable => true, :sort_number => '20', :app_name=>"Research", :intro_app_name=>"PersonalResearchIntro",:path=>"/plugin/personal_research/profile",:front_path=>"/profile",:admin_path=>"/admin/researchs",:i18n=>'module_name.personal_research', :module_app_name=>"PersonalResearch"
|
||||
version "0.1"
|
||||
organization "Rulingcom"
|
||||
author "RD dep"
|
||||
intro "I am intro"
|
||||
update_info 'some update_info'
|
||||
|
||||
frontend_enabled
|
||||
icon_class_no_sidebar "icons-user"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue