Add Brief intro. for all personal plugins
Add Share Setting for Personal Plugins ( if have old data must be add default value "field: is_hidden => false " ) Apply New UI to Member Plugin Edit Page Personal Plugin Summary fix Academic Info. list fix
This commit is contained in:
1 parent
b487740035
commit
a067bcd304
159 files changed
+5145
-3453
No files matched your search
Vendored
+37
-36
@@ -9,40 +9,18 @@ class Panel::PersonalLab::BackEnd::LabsController < OrbitBackendController
|
||||
# end
|
||||
|
||||
def index
|
||||
|
||||
get_plugins
|
||||
get_plugins
|
||||
|
||||
# get_categorys("LabCategory",params[:lab_category_ids])
|
||||
@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
|
||||
|
||||
# @lab_categorys = get_categories_for_index("LabCategory")
|
||||
# @lab_category_ids = @lab_categorys.collect{|t| t.id.to_s} + [nil]
|
||||
|
||||
|
||||
@labs = (params[:sort] || @filter) ? get_sorted_and_filtered("lab") : get_viewable("lab")
|
||||
@lab_pages = @labs.page params[:page]
|
||||
|
||||
@tags = get_tags
|
||||
# @tags = get_tags
|
||||
# @categories = get_categories_for_index
|
||||
# @statuses = get_statuses
|
||||
# category_ids = @categories.collect{|t| t.id}
|
||||
|
||||
@labs = get_sorted_and_filtered("lab")
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.js { }
|
||||
format.xml { render :xml => @labs }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
@@ -94,24 +72,24 @@ class Panel::PersonalLab::BackEnd::LabsController < OrbitBackendController
|
||||
# POST /labs.xml
|
||||
def create
|
||||
|
||||
@tags = get_tags
|
||||
@tags = get_tags
|
||||
|
||||
@lab = Lab.new(params[:lab])
|
||||
|
||||
if params[:lab][:user_id]
|
||||
if params[:lab][:user_id]
|
||||
@lab.create_user_id = params[:lab][:user_id]
|
||||
@lab.update_user_id = params[:lab][:user_id]
|
||||
else
|
||||
@lab.create_user_id = current_user.id
|
||||
@lab.create_user_id = current_user.id
|
||||
@lab.update_user_id = current_user.id
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @lab.save
|
||||
if params[:lab][:user_id]
|
||||
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:lab][:user_id],:show_plugin_profile=>'Lab')) }
|
||||
if params[:lab][:user_id]
|
||||
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:lab][:user_id],:show_plugin_profile=>"Lab")) }
|
||||
else
|
||||
format.html { redirect_to(panel_personal_lab_back_end_labs_url) }
|
||||
format.html { redirect_to(panel_personal_lab_back_end_labs_url) }
|
||||
end
|
||||
|
||||
format.xml { render :xml => @lab, :status => :created, :location => @lab }
|
||||
@@ -130,7 +108,7 @@ class Panel::PersonalLab::BackEnd::LabsController < OrbitBackendController
|
||||
|
||||
@lab.update_user_id = current_user.id
|
||||
|
||||
params[:lab][:tag_ids] ||=[]
|
||||
params[:lab][:tag_ids] ||=[]
|
||||
|
||||
respond_to do |format|
|
||||
if @lab.update_attributes(params[:lab])
|
||||
@@ -164,6 +142,29 @@ class Panel::PersonalLab::BackEnd::LabsController < OrbitBackendController
|
||||
end
|
||||
redirect_to panel_personal_lab_back_end_labs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||
end
|
||||
|
||||
def data_share
|
||||
|
||||
if params[:ids]
|
||||
|
||||
@labs = Lab.any_in(:_id => params[:ids])
|
||||
|
||||
@labs.each do |lab|
|
||||
|
||||
lab.is_hidden = params[:disable]
|
||||
|
||||
lab.save
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:user_id],:show_plugin_profile=>"Lab")) }
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Panel::PersonalLab::BackEnd::PersonalLabIntrosController < Admin::PersonalPluginIntrosController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_type = 'personal_lab_intro'
|
||||
@app_type_name = 'personal_lab'
|
||||
@reback_name = 'Lab'
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class PersonalLabIntro < PersonalPluginIntro
|
||||
|
||||
|
||||
end
|
||||
Vendored
+272
-198
@@ -1,214 +1,288 @@
|
||||
<% # 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 %>
|
||||
|
||||
<%= f.error_messages %>
|
||||
|
||||
<!--Widget start-->
|
||||
|
||||
<div id="sub-wiget">
|
||||
<!-- Input Area -->
|
||||
<div class="input-area">
|
||||
|
||||
<div id="widget-tags" class="widget-box widget-size-300">
|
||||
<div class="widget-action clear tip" title="Setting">
|
||||
<a class="action"><i class="icon-cog icon-white"></i></a>
|
||||
</div>
|
||||
<h3 class="widget-title"><i class="icons-tag"></i>Tags</h3>
|
||||
<div class="widget-content clear form-horizontal">
|
||||
<% @tags.each do |tag| %>
|
||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
||||
<%= check_box_tag 'lab[tag_ids][]', tag.id, @lab.tag_ids.include?(tag.id)%>
|
||||
<%= tag.name %>
|
||||
<%= hidden_field_tag 'lab[tag_ids][]', '' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--Wiget End-->
|
||||
<!--Post Start-->
|
||||
<!-- 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>
|
||||
<% if show_form_status_field(@lab) %>
|
||||
<li>
|
||||
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="post-body">
|
||||
<div id="post-body-content" class="clear">
|
||||
|
||||
<% if !params[:user_id].blank? %>
|
||||
|
||||
<div class="span6">
|
||||
<%= t("著作人")%>
|
||||
<%= User.from_id(params[:user_id]).name rescue ''%>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :year ,t("personal_lab.year")%>
|
||||
<%= select_year((@lab.year ? @lab.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'lab[year]'} ) %>
|
||||
</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 :lab_title ,t("personal_lab.lab_title")%>
|
||||
<%= f.fields_for :lab_title_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title', :value => (@lab.lab_title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :location ,t("personal_lab.location")%>
|
||||
<%= f.fields_for :location_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title', :value => (@lab.location_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :participating_professor ,t("personal_lab.participating_professor")%>
|
||||
<%= f.fields_for :participating_professor_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title', :value => (@lab.participating_professor_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :participating_student ,t("personal_lab.participating_student")%>
|
||||
<%= f.fields_for :participating_student_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title', :value => (@lab.participating_student_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Module -->
|
||||
<div class="tab-content module-area">
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<!-- Basic Module -->
|
||||
<div class="tab-pane fade in active" id="basic">
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :extension_no, t("personal_lab.extension_no") %>
|
||||
<%= f.text_field :extension_no %>
|
||||
</div>
|
||||
<% if !params[:user_id].blank? %>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
|
||||
<div class="controls">
|
||||
<%= User.from_id(params[:user_id]).name rescue ''%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :research_direction, t("personal_lab.research_direction") %>
|
||||
<%= f.text_field :research_direction %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :facility, t("personal_lab.facility") %>
|
||||
<%= f.text_field :facility %>
|
||||
</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>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :url, t("personal_lab.url") %>
|
||||
<%= f.text_field :url %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :keywords, t("personal_lab.keywords") %>
|
||||
<%= f.text_field :keywords %>
|
||||
</div>
|
||||
|
||||
<div id="title">
|
||||
<%= f.label :language, t("personal_lab.language") %>
|
||||
<%= f.radio_button :language, "Chinese" %> <%= t("personal_lab.Chinese") %>
|
||||
<%= f.radio_button :language, "English" %> <%= t("personal_lab.English") %>
|
||||
</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>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :note, t("personal_lab.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', @lab.lab_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>
|
||||
|
||||
<% @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 %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!--Post End-->
|
||||
<!-- 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>
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<!-- language -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_lab.language") %></label>
|
||||
<div class="controls">
|
||||
<%= f.radio_button :language, "Chinese" %> <%= t("personal_lab.Chinese") %>
|
||||
<%= f.radio_button :language, "English" %> <%= t("personal_lab.English") %>
|
||||
</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 -->
|
||||
<% if show_form_status_field(@lab) %>
|
||||
<div class="tab-pane fade" id="status">
|
||||
|
||||
<!-- 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>
|
||||
<% end %>
|
||||
|
||||
<!-- Tag Module -->
|
||||
<div class="tab-pane fade" id="tag">
|
||||
|
||||
<!-- Tag -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:tags) %></label>
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<% @tags.each do |tag| %>
|
||||
<label class="checkbox inline btn <%= 'active' if @lab.tag_ids.include?(tag.id) %>">
|
||||
<%= check_box_tag 'lab[tag_ids][]', tag.id, @lab.tag_ids.include?(tag.id) %> <%= tag.name %>
|
||||
<%= hidden_field_tag 'lab[tag_ids][]', '' %>
|
||||
</label>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Language Tabs -->
|
||||
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
||||
<ul class="nav nav-pills language-nav">
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<li class="<%= 'active' if i == 0 %>">
|
||||
<a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<!-- Language -->
|
||||
<div class="tab-content language-area">
|
||||
|
||||
<% @site_valid_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_chapters_translations do |f| %>
|
||||
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_lab.participating_professor"), value: (@lab.participating_professor_chapters_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 %>
|
||||
<%= 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, :lab_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>
|
||||
<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 %>
|
||||
Vendored
+45
-50
@@ -1,50 +1,45 @@
|
||||
<% # 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>
|
||||
|
||||
<% 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_valid_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>
|
||||
<% 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>
|
||||
Vendored
-5
@@ -1,9 +1,4 @@
|
||||
<tr id="<%= dom_id lab %>" class="with_action">
|
||||
<td class="span1">
|
||||
<% if (lab.create_user_id == current_user.id) || is_manager? %>
|
||||
<%= check_box_tag 'to_delete[]', lab.id, false, :class => "checkbox_in_list" %>
|
||||
<% end -%>
|
||||
</td>
|
||||
<td class="span1"><%= lab.year %></td>
|
||||
<td class="span1">
|
||||
<%= link_to lab.lab_title, panel_personal_lab_front_end_lab_path(lab) %>
|
||||
|
||||
Vendored
+5
-5
@@ -8,8 +8,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
<h1><%= t('personal_lab.editing_personal_lab') %></h1>
|
||||
|
||||
<%= form_for @lab, :url => panel_personal_lab_back_end_lab_path(@lab), :html => {:class => 'clear'} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
<%= form_for @lab, url: panel_personal_lab_back_end_lab_path(@lab), html: {class: "form-horizontal main-forms previewable"} do |f| %>
|
||||
<fieldset>
|
||||
<%= render partial: 'form', locals: {f: f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
Vendored
+10
-9
@@ -13,11 +13,10 @@
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1"></th>
|
||||
<th class="span1"></th>
|
||||
<th class="span1"></th>
|
||||
<th class="span1"></th>
|
||||
<th class="span1"></th>
|
||||
<th class="span1"><%= t('personal_lab.year') %></th>
|
||||
<th class="span3"><%= t('personal_lab.lab_title') %></th>
|
||||
<th class="span2"><%= t('personal_lab.location') %></th>
|
||||
<th class="span1"><%= t("personal_plugins.author") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_labs" class="sort-holder">
|
||||
@@ -25,9 +24,11 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_lab_back_end_lab_path, :class => 'btn btn-primary pull-right' %>
|
||||
<div id="lab_pagination" class="paginationFixed">
|
||||
<%= paginate @lab_pages, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= paginate @labs, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
|
||||
</div>
|
||||
</div>
|
||||
Vendored
+5
-11
@@ -8,14 +8,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
<%= flash_messages %>
|
||||
|
||||
<div id="poststuff">
|
||||
<h1><%= t('lab.new_personal_lab') %></h1>
|
||||
<%= form_for @lab, :url => panel_personal_lab_back_end_labs_path, :html => {:class => 'clear'} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%#= link_back %>
|
||||
|
||||
<%= form_for @lab, url: panel_personal_lab_back_end_labs_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
|
||||
<fieldset>
|
||||
<%= render partial: 'form', locals: {f: f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
Vendored
+42
-32
@@ -1,40 +1,50 @@
|
||||
<%
|
||||
if @member
|
||||
@labs = Lab.where(:create_user_id => @member.id).desc(:year)
|
||||
else
|
||||
@labs = Lab.all.desc(:year)
|
||||
end
|
||||
|
||||
@labs = Lab.where(is_hidden: false, :create_user_id => @member.id).desc(:year)
|
||||
|
||||
@lab_intro = !PersonalLabIntro.where(:user_id => @member.id).blank? ? PersonalLabIntro.where(:user_id => @member.id).first : PersonalLabIntro.new
|
||||
%>
|
||||
|
||||
<% if !@labs.blank? %>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="grid1"><%= t('personal_lab.year') %></th>
|
||||
<th class="grid7"><%= t('personal_lab.lab_title') %></th>
|
||||
<th class="grid4"><%= t('personal_lab.location') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<% @labs.each do |lab| %>
|
||||
|
||||
<tr>
|
||||
<td><%= lab.year %></td>
|
||||
<td>
|
||||
<%= link_to lab.lab_title, panel_personal_lab_front_end_lab_path(lab) %>
|
||||
</td>
|
||||
<td><%= lab.location %></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<% if @lab_intro.brief_intro and !@lab_intro.blank? %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="info">
|
||||
<%= @lab_intro.text.html_safe rescue '' %>
|
||||
</div>
|
||||
|
||||
<% else %>
|
||||
<% end %>
|
||||
|
||||
<%= t('nothing')%>
|
||||
<% if ( !@lab_intro.blank? and @lab_intro.complete_list ) or @lab_intro.blank? %>
|
||||
|
||||
<% end %>
|
||||
<% if !@labs.blank? %>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="grid1"><%= t('personal_lab.year') %></th>
|
||||
<th class="grid7"><%= t('personal_lab.lab_title') %></th>
|
||||
<th class="grid4"><%= t('personal_lab.location') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<% @labs.each do |lab| %>
|
||||
|
||||
<tr>
|
||||
<td><%= lab.year %></td>
|
||||
<td>
|
||||
<%= link_to lab.lab_title, panel_personal_lab_front_end_lab_path(lab) %>
|
||||
</td>
|
||||
<td><%= lab.location %></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
+42
-5
@@ -1,3 +1,10 @@
|
||||
<% 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 %>
|
||||
|
||||
<%
|
||||
@filter = params[:filter]
|
||||
new_filter = params[:new_filter]
|
||||
@@ -17,18 +24,29 @@
|
||||
end
|
||||
|
||||
|
||||
if @user
|
||||
@labs = Lab.where(:create_user_id => @user.id).page(params[:page]).per(10)
|
||||
if @user && is_admin?
|
||||
@labs = Lab.where(:create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
|
||||
else
|
||||
@labs = Lab.all.page(params[:page]).per(10)
|
||||
@labs = Lab.where(is_hidden: false, :create_user_id => @user.id).desc(:year).page(params[:page]).per(10)
|
||||
end
|
||||
|
||||
|
||||
%>
|
||||
|
||||
<% if is_admin? %>
|
||||
<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 => data_share_panel_personal_lab_back_end_labs_path(:user_id => params[:id], :disable => 'true') ) %>
|
||||
<%= link_to('Show', '#', :class => "btn btn-mini list-active-btn disabled", "data-check-action" => "list-be-show", :rel => data_share_panel_personal_lab_back_end_labs_path(:user_id => params[:id], :disable => 'false') ) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
||||
<table class="table table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<% if is_admin? %>
|
||||
<th><input type="checkbox" class="list-check" /></th>
|
||||
<% end -%>
|
||||
<th class="span1"><%= t('personal_lab.year') %></th>
|
||||
<th><%= t('personal_lab.lab_title') %></th>
|
||||
<th><%= t('personal_lab.location') %></th>
|
||||
@@ -38,7 +56,12 @@
|
||||
|
||||
<% @labs.each do |lab| %>
|
||||
|
||||
<tr>
|
||||
<tr class="<%= lab.is_hidden ? "checkHide" : "" %>">
|
||||
<% if is_admin? %>
|
||||
<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, panel_personal_lab_front_end_lab_path(lab) %>
|
||||
@@ -51,11 +74,25 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<% if is_admin? %>
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_lab_back_end_personal_lab_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_lab_back_end_lab_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= paginate @labs, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<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>
|
||||
@@ -13,9 +13,11 @@ Rails.application.routes.draw do
|
||||
resources :labs do
|
||||
collection do
|
||||
get 'delete'
|
||||
get 'data_share'
|
||||
end
|
||||
end
|
||||
|
||||
resources :personal_lab_intros
|
||||
resources :tags
|
||||
end
|
||||
namespace :front_end do
|
||||
|
||||
+1
-1
@@ -2,7 +2,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,:path=>"panel/personal_lab/plugin/profile",:front_path=>"panel/personal_lab/front_end/profile",:admin_path=>"/panel/personal_lab/back_end/labs",:i18n=>'module_name.personal_lab'
|
||||
personal_plugin :enable => true, :app_name=>"Lab", :intro_app_name=>"PersonalLabIntro",:path=>"panel/personal_lab/plugin/profile",:front_path=>"panel/personal_lab/front_end/profile",:admin_path=>"/panel/personal_lab/back_end/labs",:i18n=>'module_name.personal_lab'
|
||||
|
||||
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user