test
This commit is contained in:
parent
2df2919aad
commit
b18572f6e4
|
@ -4,6 +4,7 @@ class Admin::PatchfilesController < OrbitAdminController
|
|||
include Admin::PatchfilesHelper
|
||||
before_action :getfont , :create_first_field
|
||||
#before_action :load_access_levels
|
||||
layout "structure"
|
||||
def initialize
|
||||
super
|
||||
@app_title = "patchfile"
|
||||
|
|
|
@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|||
# Maintain your gem's version:
|
||||
require "patchfile/version"
|
||||
app_path = File.expand_path(__dir__)
|
||||
if !Dir.exist?(ENV['PWD']+"/app/assets/stylesheets/lib/jquery-ui-1.12.1/")
|
||||
if !Dir.exist?("#{ENV['PWD']}"+"/app/assets/stylesheets/lib/jquery-ui-1.12.1/")
|
||||
puts "copying jquery-ui"
|
||||
begin
|
||||
`cp -r "#{app_path}/updatefiles/accessibility/jquery-ui-1.12.1/." "#{ENV['PWD']}/app/assets/stylesheets/lib/jquery-ui-1.12.1/"`
|
||||
|
@ -11,6 +11,23 @@ if !Dir.exist?(ENV['PWD']+"/app/assets/stylesheets/lib/jquery-ui-1.12.1/")
|
|||
puts "There is an error in coppying jquery-ui"
|
||||
end
|
||||
end
|
||||
#Add patchfile to Admin area
|
||||
@patchfile_li = File.read(app_path+"/patchfile_li.txt")
|
||||
@patchfile_li_choices = File.read(app_path+"/patchfile_li_choices.txt")
|
||||
Dir.chdir(ENV['PWD']+'/app/views/shared') do
|
||||
@file_text = File.read("_side_bar.html.erb")
|
||||
if @file_text.include?('<div class="patchfile sub-nav-block icons-megaphone">')
|
||||
@indert_index = @file_text.index('</nav>')
|
||||
@file_text.insert(@indert_index , @patchfile_li_choices)
|
||||
end
|
||||
if @file_text.include?('patchfile_li')
|
||||
@indert_index = @file_text.index('</nav>')
|
||||
@file_text.insert(@indert_index , @patchfile_li_choices)
|
||||
end
|
||||
f = File.open('_side_bar.html.erb','w')
|
||||
f.write(@file_text)
|
||||
f.close
|
||||
end
|
||||
# Describe your gem and declare its dependencies:
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "patchfile"
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
<style>
|
||||
#sidebar .sub-nav-block-list .sub-nav-block{
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #0088CC;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(window).load(function(){
|
||||
if($.support.touch) {
|
||||
mouseenterEvent = clickEvent = "touchstart";
|
||||
} else {
|
||||
clickEvent = "click";
|
||||
mouseenterEvent = "mouseenter";
|
||||
};
|
||||
var $arrowHeightFormat = $('.sub-nav-arrow').outerHeight(true)/2,$arrow = $('.sub-nav-arrow');
|
||||
var $lilist = $('.patchfile .nav-list>li');
|
||||
for(var i=0;i<$lilist.length;i++)
|
||||
if($lilist.eq(i).find('>a').attr('href')==window.location.pathname)
|
||||
$lilist.eq(i).addClass('active');
|
||||
else
|
||||
$lilist.eq(i).removeClass('active');
|
||||
$('.sidebar-nav').children('li').off(mouseenterEvent);
|
||||
$('.patchfile_li').off(mouseenterEvent).on(mouseenterEvent, function(e) {
|
||||
$('#sidebar').addClass('on')
|
||||
$('.sub-nav-block').addClass('show');
|
||||
$arrow.stop(true, false).animate({
|
||||
top: ($(this).position().top+$(this).height()/2)-$arrowHeightFormat+$('.scroller').position().top,
|
||||
},{
|
||||
duration: 500,
|
||||
easing: 'easeInOutBack',
|
||||
});
|
||||
if(!$('.patchfile_li').hasClass('active')) {
|
||||
$('.sub-nav-block-list').css({'width': 180});
|
||||
if($('#pageslide').length) {
|
||||
if($('#pageslide').is(":hidden")) {
|
||||
$('#main-wrap').css({
|
||||
'margin-left': $('.sub-nav-block-list').width()+$('.sidebar-nav').width(),
|
||||
});
|
||||
}
|
||||
}else{
|
||||
$('#main-wrap').css({
|
||||
'margin-left': $('.sub-nav-block-list').width()+$('.sidebar-nav').width(),
|
||||
});
|
||||
}
|
||||
if($('.bottomnav').length) {
|
||||
$('.bottomnav').css({
|
||||
'left': $('.sub-nav-block-list').width()+$('.sidebar-nav').width()+20,
|
||||
});
|
||||
}
|
||||
$('#sidebar').css({
|
||||
'width': $('.sub-nav-block-list').width()+$('.sidebar-nav').width(),
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<li class='patchfile_li' title="<%= (I18n.locale.to_s == 'en') ? 'Patchfile' : '抓取檔案' %>">
|
||||
<%= link_to admin_patchfiles_path, :class => active_for_action('patchfiles', 'index') do %>
|
||||
<span><i class="icons-megaphone"></i></span>
|
||||
<%end%>
|
||||
</li>
|
|
@ -0,0 +1,10 @@
|
|||
<% @patchfile = (I18n.locale.to_s) == 'en' ? 'Patchfile' : '抓取檔案'%>
|
||||
<div class="sub-nav-block-list" style="width: 0px;">
|
||||
<div class="patchfile sub-nav-block icons-megaphone">
|
||||
<h4><%=@patchfile%></h4>
|
||||
<ul class="nav nav-list">
|
||||
<li><a href="/admin/patchfiles"><span><%=@patchfile%></span></a></li>
|
||||
<li><a href="/admin/patchfiles/showckeditor"><span>CKEDITOR</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue