Finished
This commit is contained in:
parent
52fc6b030d
commit
01c63950b2
|
@ -0,0 +1,88 @@
|
|||
class Admin::LabsController < OrbitMemberController
|
||||
layout "member_plugin"
|
||||
|
||||
before_action :set_plugin
|
||||
before_action :get_settings,:only => [:new, :edit, :setting]
|
||||
|
||||
def index
|
||||
@labs = Lab.all
|
||||
end
|
||||
|
||||
def new
|
||||
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
|
||||
@lab = Lab.new
|
||||
end
|
||||
|
||||
def create
|
||||
@member = MemberProfile.find(lab_params['member_profile_id']) rescue nil
|
||||
@lab = Lab.new(lab_params)
|
||||
@lab.save
|
||||
redirect_to '/admin/members/'+@member.to_param+'/Lab'
|
||||
end
|
||||
|
||||
def edit
|
||||
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
|
||||
@lab = Lab.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@member = MemberProfile.find(lab_params['member_profile_id']) rescue nil
|
||||
@lab = Lab.find(params[:id])
|
||||
@lab.update_attributes(lab_params)
|
||||
@lab.save
|
||||
redirect_to '/admin/members/'+@member.to_param+'/Lab'
|
||||
end
|
||||
|
||||
def destroy
|
||||
@lab = Lab.find(params[:id])
|
||||
@lab.destroy
|
||||
end
|
||||
|
||||
def toggle_hide
|
||||
if params[:ids]
|
||||
@labs = Lab.any_in(_id: params[:ids])
|
||||
|
||||
@labs.each do |lab|
|
||||
lab.is_hidden = params[:disable]
|
||||
lab.save
|
||||
end
|
||||
end
|
||||
|
||||
render json: {"success"=>true}
|
||||
end
|
||||
|
||||
def setting
|
||||
end
|
||||
|
||||
def frontend_setting
|
||||
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
|
||||
@intro = LabIntro.find_by(:member_profile_id=>@member.id) rescue nil
|
||||
@intro = @intro.nil? ? LabIntro.new({:member_profile_id=>@member.id}) : @intro
|
||||
end
|
||||
|
||||
def update_frontend_setting
|
||||
@member = MemberProfile.find(intro_params['member_profile_id']) rescue nil
|
||||
@intro = LabIntro.find_by(:member_profile_id=>@member.id) rescue nil
|
||||
@intro = @intro.nil? ? LabIntro.new({:member_profile_id=>@member.id}) : @intro
|
||||
@intro.update_attributes(intro_params)
|
||||
@intro.save
|
||||
redirect_to '/admin/members/'+@member.to_param+'/Lab'
|
||||
end
|
||||
|
||||
def get_settings
|
||||
end
|
||||
|
||||
def set_plugin
|
||||
@plugin = OrbitApp::Plugin::Registration.all.select{|plugin| plugin.app_name.eql? 'Lab'}.first
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def lab_params
|
||||
params.require(:lab).permit! rescue nil
|
||||
end
|
||||
|
||||
def intro_params
|
||||
params.require(:lab_intro).permit! rescue nil
|
||||
end
|
||||
end
|
|
@ -0,0 +1,69 @@
|
|||
class PersonalLabsController < ApplicationController
|
||||
def index
|
||||
labs = Lab.where(:is_hidden=>false).all
|
||||
lab_list = labs.collect do |lab|
|
||||
{
|
||||
"year" => lab.year,
|
||||
"lab_title" => lab.lab_title,
|
||||
"location" => lab.location,
|
||||
"member" => lab.member_profile.name,
|
||||
"link_to_show" => OrbitHelper.url_to_show(lab.to_param)
|
||||
}
|
||||
end
|
||||
{
|
||||
"labs" => lab_list,
|
||||
"extras" => {
|
||||
"widget-title" => t("module_name.personal_lab"),
|
||||
"th_year" => t('personal_lab.year'),
|
||||
"th_lab_title" => t('module_name.personal_lab'),
|
||||
"th_location" => t('personal_lab.location'),
|
||||
"th_member" => t('users.name'),
|
||||
"th_detail" => t('detail')
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def show
|
||||
params = OrbitHelper.params
|
||||
lab = Lab.where(:is_hidden=>false).find_by(uid: params[:uid])
|
||||
|
||||
files = lab.lab_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"=>{
|
||||
"lab_title" => lab.lab_title,
|
||||
"location" => lab.location,
|
||||
"participating_professor" => lab.participating_professor,
|
||||
"participating_student" => lab.participating_student,
|
||||
"year" => lab.year,
|
||||
"keywords" => lab.keywords,
|
||||
"extension_no" => lab.extension_no,
|
||||
"research_direction" => lab.research_direction,
|
||||
"facility" => lab.facility,
|
||||
"url" => lab.url,
|
||||
"note" => lab.note,
|
||||
|
||||
"th_lab_title" => t('personal_lab.lab_title'),
|
||||
"th_location" => t('personal_lab.location'),
|
||||
"th_participating_professor" => t('personal_lab.participating_professor'),
|
||||
"th_participating_student" => t('personal_lab.participating_student'),
|
||||
"th_year" => t('personal_lab.year'),
|
||||
"th_keywords" => t('personal_lab.keywords'),
|
||||
"th_extension_no" => t('personal_lab.extension_no'),
|
||||
"th_research_direction" => t('personal_lab.research_direction'),
|
||||
"th_facility" => t('personal_lab.facility'),
|
||||
"th_url" => t('personal_lab.url'),
|
||||
"th_note" => t('personal_lab.note'),
|
||||
"td_files" => t(:file_)
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
|
@ -0,0 +1,40 @@
|
|||
class Lab
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitModel::Status
|
||||
include Slug
|
||||
|
||||
belongs_to :member_profile
|
||||
|
||||
field :lab_title, :as=>:slug_title, localize: true
|
||||
field :location, localize: true
|
||||
field :participating_professor, localize: true
|
||||
field :participating_student, localize: true
|
||||
|
||||
field :year
|
||||
field :language
|
||||
field :keywords
|
||||
field :extension_no
|
||||
field :research_direction
|
||||
field :facility
|
||||
field :url
|
||||
field :note
|
||||
field :create_user_id, :type => BSON::ObjectId
|
||||
field :update_user_id, :type => BSON::ObjectId
|
||||
|
||||
paginates_per 10
|
||||
|
||||
has_many :lab_files, :autosave => true, :dependent => :destroy
|
||||
accepts_nested_attributes_for :lab_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 LabFile
|
||||
|
||||
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 :lab
|
||||
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
class LabIntro < PersonalPluginIntro
|
||||
end
|
|
@ -0,0 +1,239 @@
|
|||
<% # 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-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_lab.year") %></label>
|
||||
<div class="controls">
|
||||
<%= select_year((@lab.year ? @lab.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'lab[year]', :class => 'span1'} ) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- extension_no -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_lab.extension_no") %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :extension_no %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- research_direction -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_lab.research_direction") %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :research_direction %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- facility -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_lab.facility") %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :facility %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- url -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_lab.url") %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :url , :class => "span6" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- keywords -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_lab.keywords") %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :keywords %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- note -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_lab.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 @lab.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" : '' %>">
|
||||
|
||||
<!-- lab_title-->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t("personal_lab.lab_title") %></label>
|
||||
<div class="controls">
|
||||
<%= f.fields_for :lab_title_translations do |f| %>
|
||||
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.lab_title"), value: (@lab.lab_title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- location-->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t("personal_lab.location") %></label>
|
||||
<div class="controls">
|
||||
<%= f.fields_for :location_translations do |f| %>
|
||||
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.location"), value: (@lab.location_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- participating_professor-->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t("personal_lab.participating_professor") %></label>
|
||||
<div class="controls">
|
||||
<%= f.fields_for :participating_professor_translations do |f| %>
|
||||
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.participating_professor"), value: (@lab.participating_professor_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- participating_student-->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t("personal_lab.participating_student") %></label>
|
||||
<div class="controls">
|
||||
<%= f.fields_for :participating_student_translations do |f| %>
|
||||
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.participating_student"), value: (@lab.participating_student_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 @lab && !@lab.lab_files.blank? %>
|
||||
<div class="exist">
|
||||
<% @lab.lab_files.each_with_index do |lab_file, i| %>
|
||||
<%= f.fields_for :lab_files, lab_file do |f| %>
|
||||
<%= render :partial => 'form_file', :object => lab_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', @lab.lab_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_lab_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, :lab_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,15 @@
|
|||
<% @labs.each do |lab| %>
|
||||
<tr id="<%= dom_id lab %>" class="<%= lab.is_hidden ? "checkHide" : "" %>">
|
||||
<td><%= lab.year %></td>
|
||||
<td>
|
||||
<%= link_to lab.lab_title, '', target: "blank"%>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><%= link_to t('edit'), '/admin/members/'+lab.member_profile.to_param+'/labs/'+lab.id+'/edit' %></li>
|
||||
<li><%= link_to t(:delete_), admin_lab_path(id: lab.id, member_profile_id: lab.member_profile.id), method: :delete, remote: true, data: { confirm: t('sure?') } %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= lab.location %></td>
|
||||
</tr>
|
||||
<% end %>
|
|
@ -0,0 +1 @@
|
|||
$('#lab_<%= @lab.id.to_s%>').remove();
|
|
@ -0,0 +1,5 @@
|
|||
<%= form_for @lab, url:'/admin/labs/'+@lab.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(:writing_conference_intro, :url => update_frontend_setting_admin_writing_conferences_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_conference") %></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,17 @@
|
|||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1"><%= t('personal_lab.year') %></th>
|
||||
<th class="span3"><%= t('module_name.personal_lab') %></th>
|
||||
<th class="span1"><%= t('personal_lab.location') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_labs" class="sort-holder">
|
||||
<%= render :partial => 'lab', :collection => @labs %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="pagination pagination-centered">
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,5 @@
|
|||
<%= form_for @lab, url: admin_labs_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
|
||||
<fieldset>
|
||||
<%= render partial: 'form', locals: {f: f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
|
@ -0,0 +1,116 @@
|
|||
<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>
|
||||
|
||||
<div class="row">
|
||||
<div class="element span4">
|
||||
<div class="detail w-a h-a">
|
||||
<p class="totle">
|
||||
<a class="btn btn-small btn-primary pull-right" href="<%= new_admin_conference_paper_type_path %>#paper_type_modal" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
|
||||
<span><%= t("personal_conference.paper_type") %></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="paper_types" class="table table-striped">
|
||||
<tbody>
|
||||
<%= render :partial => 'list_paper_type', :collection => @paper_types %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="element span4">
|
||||
<div class="detail w-a h-a">
|
||||
<p class="totle">
|
||||
<a class="btn btn-small btn-primary pull-right" href="<%= new_admin_conference_paper_level_path %>#paper_level_modal" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
|
||||
<span><%= t("personal_conference.paper_level") %></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="paper_levels" class="table table-striped">
|
||||
<tbody>
|
||||
<%= render :partial => 'list_paper_level', :collection => @paper_levels %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="element span4">
|
||||
<div class="detail w-a h-a">
|
||||
<p class="totle">
|
||||
<a class="btn btn-small btn-primary pull-right" href="<%= new_admin_conference_author_type_path %>#author_type_modal" data-toggle="modal" data-remote="true"><i class="icon-plus"></i> <%= t('add')%></a>
|
||||
<span><%= t("personal_conference.author_type") %></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="author_types" class="table table-striped">
|
||||
<tbody>
|
||||
<%= render :partial => 'list_author_type', :collection => @author_types %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="paper_type_qe">
|
||||
<div style="display:none;" class="modal" id="paper_type_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="paper_level_qe">
|
||||
<div style="display:none;" class="modal" id="paper_level_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="author_type_qe">
|
||||
<div style="display:none;" class="modal" id="author_type_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
</div>
|
||||
</div>
|
|
@ -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
|
||||
@labs = Lab.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
|
||||
else
|
||||
@labs = Lab.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_labs_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_labs_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_lab.year') %></th>
|
||||
<th class="span4"><%= t('module_name.personal_lab') %></th>
|
||||
<th><%= t('personal_lab.location') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @labs.each do |lab| %>
|
||||
<tr id="<%= dom_id lab %>" class="<%= lab.is_hidden ? "checkHide" : "" %>">
|
||||
<% if is_autorized_user %>
|
||||
<td>
|
||||
<%= check_box_tag 'to_change[]', lab.id.to_s, false, :class => "list-check" %>
|
||||
</td>
|
||||
<% end %>
|
||||
<td><%= lab.year %></td>
|
||||
<td>
|
||||
<%= link_to lab.lab_title, '', target: "blank"%>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><%= link_to t('edit'), '/admin/members/'+@member.to_param+'/labs/'+lab.id+'/edit' %></li>
|
||||
<li><%= link_to t(:delete_), admin_lab_path(id: lab.id, member_profile_id: @member.id), method: :delete, remote: true, data: { confirm: t('sure?') } %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= lab.location %></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+'/labs/frontend_setting', :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'),
|
||||
'/admin/members/'+@member.to_param+'/labs/new', :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= paginate @labs, :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 'lab_setting' => "labs#setting"
|
||||
|
||||
resources :labs do
|
||||
collection do
|
||||
get 'toggle_hide' => 'labs#toggle_hide'
|
||||
end
|
||||
end
|
||||
|
||||
resources :members do
|
||||
collection do
|
||||
scope '(:name-:uid)' do
|
||||
resources :labs do
|
||||
collection do
|
||||
get 'frontend_setting' => 'labs#frontend_setting'
|
||||
post 'update_frontend_setting' => 'labs#update_frontend_setting'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ module PersonalLab
|
|||
OrbitApp.registration "PersonalLab",:type=> 'ModuleApp' do
|
||||
module_label 'module_name.personal_lab'
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
personal_plugin :enable => true, :sort_number => '30', :app_name=>"Lab", :intro_app_name=>"PersonalLabIntro",:path=>"/plugin/profile",:front_path=>"/profile",:admin_path=>"/admin/labs",:i18n=>'module_name.personal_lab'
|
||||
personal_plugin :enable => true, :sort_number => '30', :app_name=>"Lab", :intro_app_name=>"PersonalLabIntro",:path=>"/plugin/personal_lab/profile",:front_path=>"/profile",:admin_path=>"/admin/labs",:i18n=>'module_name.personal_lab', :module_app_name=>'PersonalLab'
|
||||
|
||||
version "0.1"
|
||||
organization "Rulingcom"
|
||||
|
@ -12,6 +12,8 @@ module PersonalLab
|
|||
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