forked from saurabh/personal-diploma
Finished
This commit is contained in:
parent
cfaa4cfbdc
commit
af1e0c942a
|
@ -0,0 +1,91 @@
|
||||||
|
class Admin::DiplomasController < OrbitMemberController
|
||||||
|
layout "member_plugin"
|
||||||
|
|
||||||
|
before_action :set_plugin
|
||||||
|
before_action :get_settings,:only => [:new, :edit, :setting]
|
||||||
|
|
||||||
|
def index
|
||||||
|
@diplomas = Diploma.all
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
|
||||||
|
@diploma = Diploma.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@member = MemberProfile.find(diploma_params['member_profile_id']) rescue nil
|
||||||
|
@diploma = Diploma.new(diploma_params)
|
||||||
|
@diploma.save
|
||||||
|
redirect_to '/admin/members/'+@member.to_param+'/Diploma'
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
|
||||||
|
@diploma = Diploma.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@member = MemberProfile.find(diploma_params['member_profile_id']) rescue nil
|
||||||
|
@diploma = Diploma.find(params[:id])
|
||||||
|
@diploma.update_attributes(diploma_params)
|
||||||
|
@diploma.save
|
||||||
|
redirect_to '/admin/members/'+@member.to_param+'/Diploma'
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@diploma = Diploma.find(params[:id])
|
||||||
|
@diploma.destroy
|
||||||
|
end
|
||||||
|
|
||||||
|
def toggle_hide
|
||||||
|
if params[:ids]
|
||||||
|
@diplomas = Diploma.any_in(_id: params[:ids])
|
||||||
|
|
||||||
|
@diplomas.each do |diploma|
|
||||||
|
diploma.is_hidden = params[:disable]
|
||||||
|
diploma.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
render json: {"success"=>true}
|
||||||
|
end
|
||||||
|
|
||||||
|
def setting
|
||||||
|
end
|
||||||
|
|
||||||
|
def frontend_setting
|
||||||
|
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
|
||||||
|
@intro = DiplomaIntro.find_by(:member_profile_id=>@member.id) rescue nil
|
||||||
|
@intro = @intro.nil? ? DiplomaIntro.new({:member_profile_id=>@member.id}) : @intro
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_frontend_setting
|
||||||
|
@member = MemberProfile.find(intro_params['member_profile_id']) rescue nil
|
||||||
|
@intro = DiplomaIntro.find_by(:member_profile_id=>@member.id) rescue nil
|
||||||
|
@intro = @intro.nil? ? DiplomaIntro.new({:member_profile_id=>@member.id}) : @intro
|
||||||
|
@intro.update_attributes(intro_params)
|
||||||
|
@intro.save
|
||||||
|
redirect_to '/admin/members/'+@member.to_param+'/Diploma'
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_settings
|
||||||
|
@paper_types = ConferencePaperType.all
|
||||||
|
@paper_levels = ConferencePaperLevel.all
|
||||||
|
@author_types = ConferenceAuthorType.all
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_plugin
|
||||||
|
@plugin = OrbitApp::Plugin::Registration.all.select{|plugin| plugin.app_name.eql? 'Diploma'}.first
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def diploma_params
|
||||||
|
params.require(:diploma).permit! rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def intro_params
|
||||||
|
params.require(:diploma_intro).permit! rescue nil
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,43 @@
|
||||||
|
class Diploma
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
include OrbitModel::Status
|
||||||
|
include Slug
|
||||||
|
|
||||||
|
field :school_name, localize: true
|
||||||
|
field :country, localize: true
|
||||||
|
field :department, localize: true
|
||||||
|
field :degree, localize: true
|
||||||
|
|
||||||
|
field :language
|
||||||
|
field :keywords
|
||||||
|
field :start_date , :type => Date
|
||||||
|
field :end_date , :type => Date
|
||||||
|
field :url
|
||||||
|
field :note
|
||||||
|
field :create_user_id, :type => BSON::ObjectId
|
||||||
|
field :update_user_id, :type => BSON::ObjectId
|
||||||
|
|
||||||
|
belongs_to :member_profile
|
||||||
|
|
||||||
|
paginates_per 10
|
||||||
|
|
||||||
|
before_validation :add_http
|
||||||
|
|
||||||
|
def duration
|
||||||
|
self.start_date.to_s+' ~ '+self.end_date.to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
def slug_title
|
||||||
|
self.school_name+' '+self.department+' '+self.degree
|
||||||
|
end
|
||||||
|
|
||||||
|
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,2 @@
|
||||||
|
class DiplomaIntro < PersonalPluginIntro
|
||||||
|
end
|
|
@ -0,0 +1,16 @@
|
||||||
|
<% @diplomas.each do |diploma| %>
|
||||||
|
<tr id="<%= dom_id diploma %>" class="<%= diploma.is_hidden ? "checkHide" : "" %>">
|
||||||
|
<td><%= diploma.duration %></td>
|
||||||
|
<td>
|
||||||
|
<%= link_to diploma.school_name, '', target: "blank"%>
|
||||||
|
<div class="quick-edit">
|
||||||
|
<ul class="nav nav-pills hide">
|
||||||
|
<li><%= link_to t('edit'), '/admin/members/'+diploma.member_profile.to_param+'/diplomas/'+diploma.id+'/edit' %></li>
|
||||||
|
<li><%= link_to t(:delete_), admin_diploma_path(id: diploma.id, member_profile_id: diploma.member_profile.id), method: :delete, remote: true, data: { confirm: t('sure?') } %></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><%= diploma.department %></td>
|
||||||
|
<td><%= diploma.degree %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,182 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
<% content_for :page_specific_css do %>
|
||||||
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||||
|
<%= 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/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>
|
||||||
|
|
||||||
|
<!-- start_date -->
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t("personal_diploma.start_date") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.datetime_picker :start_date, :no_label => true, :format=>"yyyy/MM", :placeholder=>"YYYY/MM" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- end_date -->
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t("personal_diploma.end_date") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.datetime_picker :end_date, :no_label => true, :format=>"yyyy/MM", :placeholder=>"YYYY/MM" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- language -->
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t("personal_diploma.language") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<select id="diploma_language" name="diploma[language]">
|
||||||
|
<% @site_in_use_locales.each do |locale| %>
|
||||||
|
<option value="<%= locale %>" <%= @diploma.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_diploma.url") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :url, :class => "span5" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- keywords -->
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t("personal_diploma.keywords") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :keywords, :class => "span5" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- note -->
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t("personal_diploma.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">
|
||||||
|
|
||||||
|
<!-- 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 @diploma.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" : '' %>">
|
||||||
|
|
||||||
|
<!-- school_name-->
|
||||||
|
<div class="control-group input-title">
|
||||||
|
<label class="control-label muted"><%= t("personal_diploma.school_name") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.fields_for :school_name_translations do |f| %>
|
||||||
|
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_diploma.school_name"), value: (@diploma.school_name_translations[locale] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- country-->
|
||||||
|
<div class="control-group input-title">
|
||||||
|
<label class="control-label muted"><%= t("personal_diploma.country") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.fields_for :country_translations do |f| %>
|
||||||
|
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_diploma.country"), value: (@diploma.country_translations[locale] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- department-->
|
||||||
|
<div class="control-group input-title">
|
||||||
|
<label class="control-label muted"><%= t("personal_diploma.department") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.fields_for :department_translations do |f| %>
|
||||||
|
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_diploma.department"), value: (@diploma.department_translations[locale] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- degree-->
|
||||||
|
<div class="control-group input-title">
|
||||||
|
<label class="control-label muted"><%= t("personal_diploma.degree") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.fields_for :degree_translations do |f| %>
|
||||||
|
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_diploma.degree"), value: (@diploma.degree_translations[locale] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</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>
|
|
@ -0,0 +1 @@
|
||||||
|
$('#diploma_<%= @diploma.id.to_s%>').remove();
|
|
@ -0,0 +1,5 @@
|
||||||
|
<%= form_for @diploma, url:'/admin/diplomas/'+@diploma.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(:diploma_intro, :url => update_frontend_setting_admin_diplomas_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,21 @@
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="span3"><%= t('date_') %></th>
|
||||||
|
<th class="span3"><%= t('personal_diploma.school_name') %></th>
|
||||||
|
<th class="span3"><%= t('personal_diploma.department') %></th>
|
||||||
|
<th class="span3"><%= t('personal_diploma.degree') %></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="tbody_diplomas" class="sort-holder">
|
||||||
|
<%= render :partial => 'diploma', :collection => @diplomas %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!-- <div class="bottomnav clearfix">
|
||||||
|
<div class="action pull-right">
|
||||||
|
<%#= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_diploma_setting_path, :class => 'btn btn-primary pull-right' %>
|
||||||
|
</div>
|
||||||
|
<div class="pagination pagination-centered">
|
||||||
|
</div>
|
||||||
|
</div> -->
|
|
@ -0,0 +1,5 @@
|
||||||
|
<%= form_for @diploma, url: admin_diplomas_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,86 @@
|
||||||
|
<% 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
|
||||||
|
@diplomas = Diploma.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
|
||||||
|
else
|
||||||
|
@diplomas = Diploma.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_diplomas_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_diplomas_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="span3"><%= t('date_') %></th>
|
||||||
|
<th class="span3"><%= t('personal_diploma.school_name') %></th>
|
||||||
|
<th class="span3"><%= t('personal_diploma.department') %></th>
|
||||||
|
<th class="span3"><%= t('personal_diploma.degree') %></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @diplomas.each do |diploma| %>
|
||||||
|
<tr id="<%= dom_id diploma %>" class="<%= diploma.is_hidden ? "checkHide" : "" %>">
|
||||||
|
<% if is_autorized_user %>
|
||||||
|
<td>
|
||||||
|
<%= check_box_tag 'to_change[]', diploma.id.to_s, false, :class => "list-check" %>
|
||||||
|
</td>
|
||||||
|
<% end %>
|
||||||
|
<td><%= diploma.duration %></td>
|
||||||
|
<td>
|
||||||
|
<%= link_to diploma.school_name, '', target: "blank"%>
|
||||||
|
<div class="quick-edit">
|
||||||
|
<ul class="nav nav-pills hide">
|
||||||
|
<li><%= link_to t('edit'), '/admin/members/'+@member.to_param+'/diplomas/'+diploma.id+'/edit' %></li>
|
||||||
|
<li><%= link_to t(:delete_), admin_diploma_path(id: diploma.id, member_profile_id: @member.id), method: :delete, remote: true, data: { confirm: t('sure?') } %></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><%= diploma.department %></td>
|
||||||
|
<td><%= diploma.degree %></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+'/diplomas/frontend_setting', :class => 'btn btn-primary' %>
|
||||||
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'),
|
||||||
|
'/admin/members/'+@member.to_param+'/diplomas/new', :class => 'btn btn-primary' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<div class="pagination pagination-centered">
|
||||||
|
<%= paginate @diplomas, :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,9 @@ en:
|
||||||
module_name:
|
module_name:
|
||||||
personal_diploma: Diploma
|
personal_diploma: Diploma
|
||||||
personal_diploma:
|
personal_diploma:
|
||||||
|
school_name : "School Name"
|
||||||
|
duration: "Duration"
|
||||||
|
|
||||||
paper_title : "Paper Title"
|
paper_title : "Paper Title"
|
||||||
book_title : "Book Title"
|
book_title : "Book Title"
|
||||||
extracted_chapters : "Extracted Chapters"
|
extracted_chapters : "Extracted Chapters"
|
||||||
|
|
|
@ -2,6 +2,9 @@ zh_tw:
|
||||||
module_name:
|
module_name:
|
||||||
personal_diploma: 學歷
|
personal_diploma: 學歷
|
||||||
personal_diploma:
|
personal_diploma:
|
||||||
|
school_name : "學校名稱"
|
||||||
|
duration: "期間"
|
||||||
|
|
||||||
paper_title : "論文名稱"
|
paper_title : "論文名稱"
|
||||||
book_title : "期刊名稱"
|
book_title : "期刊名稱"
|
||||||
extracted_chapters : "摘要"
|
extracted_chapters : "摘要"
|
||||||
|
@ -31,7 +34,7 @@ zh_tw:
|
||||||
file_name : "檔案名稱"
|
file_name : "檔案名稱"
|
||||||
description : "描述"
|
description : "描述"
|
||||||
pages : "Pages"
|
pages : "Pages"
|
||||||
school_name : "學校名稱"
|
|
||||||
country : "國家"
|
country : "國家"
|
||||||
department : "系所"
|
department : "系所"
|
||||||
degree : "學位"
|
degree : "學位"
|
||||||
|
|
|
@ -2,6 +2,27 @@ Rails.application.routes.draw do
|
||||||
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
|
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
|
||||||
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
|
get 'diploma_setting' => "diplomas#setting"
|
||||||
|
|
||||||
|
resources :diplomas do
|
||||||
|
collection do
|
||||||
|
get 'toggle_hide' => 'diplomas#toggle_hide'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
resources :members do
|
||||||
|
collection do
|
||||||
|
scope '(:name-:uid)' do
|
||||||
|
resources :diplomas do
|
||||||
|
collection do
|
||||||
|
get 'frontend_setting' => 'diplomas#frontend_setting'
|
||||||
|
post 'update_frontend_setting' => 'diplomas#update_frontend_setting'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ module PersonalDiploma
|
||||||
OrbitApp.registration "PersonalDiploma",:type=> 'ModuleApp' do
|
OrbitApp.registration "PersonalDiploma",:type=> 'ModuleApp' do
|
||||||
module_label 'module_name.personal_journal'
|
module_label 'module_name.personal_journal'
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
personal_plugin :enable => true, :sort_number => '40', :app_name=>"Diploma", :intro_app_name=>"PersonalDiplomaIntro",:path=>"/plugin/profile",:front_path=>"/profile",:admin_path=>"/admin/diplomas",:i18n=>'module_name.personal_diploma'
|
personal_plugin :enable => true, :sort_number => '40', :app_name=>"Diploma", :intro_app_name=>"PersonalDiplomaIntro",:path=>"/plugin/personal_diploma/profile",:front_path=>"/profile",:admin_path=>"/admin/diplomas",:i18n=>'module_name.personal_diploma'
|
||||||
|
|
||||||
version "0.1"
|
version "0.1"
|
||||||
organization "Rulingcom"
|
organization "Rulingcom"
|
||||||
|
|
Loading…
Reference in New Issue