fix some bug

This commit is contained in:
BOHUNG 2020-01-30 16:08:30 +08:00
parent b393baab90
commit 11ada5f7ad
2 changed files with 62 additions and 7 deletions

View File

@ -1,3 +1,58 @@
<script src="/assets/lib/jquery-ui-1.12.1/jquery-ui.min.js"></script>
<script type="text/javascript">
/* 修正bootstap.js和jquery-ui.js間的衝突,使tab按鈕能正常運作 */
var Button = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.button.defaults, options)
}
Button.prototype.setState = function (state) {
var d = 'disabled'
, $el = this.$element
, data = $el.data()
, val = $el.is('input') ? 'val' : 'html'
state = state + 'Text'
data.resetText || $el.data('resetText', $el[val]())
$el[val](data[state] || this.options[state])
// push to event loop to allow forms to submit
setTimeout(function () {
state == 'loadingText' ?
$el.addClass(d).attr(d, d) :
$el.removeClass(d).removeAttr(d)
}, 0)
}
Button.prototype.toggle = function () {
var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
$parent && $parent
.find('.active')
.removeClass('active')
this.$element.toggleClass('active')
}
/* BUTTON PLUGIN DEFINITION
* ======================== */
var old = $.fn.button
$.fn.button = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('button')
, options = typeof option == 'object' && option
if (!data) $this.data('button', (data = new Button(this, options)))
if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}
/* 修正bootstap.js和jquery-ui.js間的衝突,使tab按鈕能正常運作 */
</script>
<link rel="stylesheet" href="/assets/lib/jquery-ui-1.12.1/jquery-ui.min.css">
<div style="clear:both;"></div>
<% @i = 0 %>
<button id="clickall"><%= (I18n.locale.to_s == "zh_tw") ? "全選" : "select all" %></button>

View File

@ -1,13 +1,13 @@
require "yaml"
module Patchfile
class Engine < ::Rails::Engine
# initializer "patchfile" do
# OrbitApp.registration "Patchfile", :type => "ModuleApp" do
# base_url File.expand_path File.dirname(__FILE__)
initializer "patchfile" do
OrbitApp.registration "Patchfile", :type => "ModuleApp" do
base_url File.expand_path File.dirname(__FILE__)
# taggable "patchfilefield"
# categorizable
# authorizable
# side_bar do
side_bar do
# head_label_i18n 'patchfile.patchfile', icon_class: "icons-megaphone"
# available_for "users"
# active_for_controllers (['admin/patchfiles'])
@ -25,13 +25,13 @@ module Patchfile
# :active_for_action=>{'admin/patchfiles'=>'showckeditor'},
# :available_for => 'users'
# end
# end
end
end
# # temp = YAML.load_file(File.join(Rails.root,"config","mongoid.yml"))
# # dbsettings = temp["production"]["sessions"]["default"]
# # s = Moped::Session.new(dbsettings["hosts"])
# # s.use dbsettings["database"]
# # s[:bulletins].indexes.create({expirable_created_at: 1},{ expireAfterSeconds: 180 })
# end
end
end
end