oxidized-web 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of oxidized-web might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11143fb32d5b312f34baa0ee5c6f071d9aa02480
4
- data.tar.gz: 86890aabfe80944b00e4c5df301e46b76108a11a
3
+ metadata.gz: 979e03b93b91bc559814e892233d5a4eae88bc99
4
+ data.tar.gz: 348e59fa008ed34575fd59690735819f68c47e29
5
5
  SHA512:
6
- metadata.gz: 098fdd2e9554db2507880072ff7f542c3cb1df516530279541eff4db3995e670bd08509174ca3c6a5519f729e8ee7a4da2b3785d19211c62042a47bec7ec812c
7
- data.tar.gz: 3c4f1a1e16e250bbc771ad54c13a5e4741b4babeefba52d22cc349fd8734ad70cf4f61dd49a4a099740bf17d91084fd251e9d5fc9e362c75cbf0498636028275
6
+ metadata.gz: 61906ef3fc96da9d938ef8da5a14288e91860bdceabe8123011b31988488c99aaf1437f3b7e95d5aeb2ccada9faffa8e9d27158e1c72eb1aead4d2fdeb99c5ec
7
+ data.tar.gz: 2007c5a11f8ea73424708d0fc998f121673bcd4d9e1c5ab6f9dce8dae5d31d8adc857e98b1f2a261336af56f4c87f435873abba04481cca3f23dec2ebe2d2b37
@@ -0,0 +1,31 @@
1
+ ---
2
+
3
+ engines:
4
+ duplication:
5
+ enabled: true
6
+ config:
7
+ languages:
8
+ - ruby
9
+ - javascript
10
+ fixme:
11
+ enabled: true
12
+ eslint:
13
+ enabled: true
14
+ rubocop:
15
+ enabled: true
16
+ scss-lint:
17
+ enabled: true
18
+
19
+ ratings:
20
+ paths:
21
+ - "**.rb"
22
+ - "**.js"
23
+ - "**.css"
24
+ - "**.sass"
25
+
26
+ exclude_paths:
27
+ - 'lib/oxidized/web/public/css/*'
28
+ - 'lib/oxidized/web/public/scripts/bootstrap.min.js'
29
+ - 'lib/oxidized/web/public/scripts/dataTables*'
30
+ - 'lib/oxidized/web/public/scripts/jquery*'
31
+
@@ -0,0 +1,5 @@
1
+ ---
2
+
3
+ LineLength:
4
+ # Default line length is silly. 100 is more realistic.
5
+ Max: 100
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ end
17
17
  desc 'Run minitest'
18
18
  task :test do
19
19
  Rake::TestTask.new do |t|
20
- t.libs.push "lib"
20
+ t.libs.push 'lib'
21
21
  t.test_files = FileList['spec/*_spec.rb']
22
22
  t.verbose = true
23
23
  end
@@ -31,7 +31,7 @@ task :build do
31
31
  end
32
32
 
33
33
  desc 'Install gem'
34
- task :install => :build do
34
+ task install: :build do
35
35
  system "sudo -Es sh -c \'umask 022; gem install gems/#{file}\'"
36
36
  end
37
37
 
@@ -46,6 +46,6 @@ task :tag do
46
46
  end
47
47
 
48
48
  desc 'Push to rubygems'
49
- task :push => :tag do
49
+ task push: :tag do
50
50
  system "gem push gems/#{file}"
51
51
  end
@@ -13,8 +13,8 @@ module Oxidized
13
13
  port, addr = addr, nil if not port
14
14
  uri = '/' + uri.to_s
15
15
  @opts = {
16
- :Host => addr,
17
- :Port => port,
16
+ Host: addr,
17
+ Port: port,
18
18
  }
19
19
  WebApp.set :nodes, nodes
20
20
  @app = Rack::Builder.new do
@@ -6,27 +6,26 @@ module Oxidized
6
6
  @cloginrc = cloginrc
7
7
  @path_new_router = path_new_router
8
8
  end
9
-
10
- #read cloginrc and return a hash with node name, which a hash value which contains user, password, eventually enable
9
+
10
+ # read cloginrc and return a hash with node name, which a hash value which contains user,
11
+ # password, eventually enable
11
12
  def cloginrc clogin_file
12
13
  close_file = clogin_file
13
14
  file = close_file.read
14
- file = file.gsub("add", '')
15
-
15
+ file = file.gsub('add', '')
16
+
16
17
  hash = {}
17
18
  file.each_line do |line|
18
-
19
-
20
- #stock all device name, and password and enable if there is one
21
- line = line.split(" ")
19
+ # stock all device name, and password and enable if there is one
20
+ line = line.split(' ')
22
21
  for i in 0..line.length
23
- if line[i] == "user"
24
- #add the equipment and user if not exist
22
+ if line[i] == 'user'
23
+ # add the equipment and user if not exist
25
24
  unless hash[line[i + 1]]
26
- hash[line[i + 1]] = {:user=>line[i + 2]}
25
+ hash[line[i + 1]] = { user: line[i + 2] }
27
26
  end
28
- #if the equipment exist, add password and enable password
29
- elsif line[i] == "password"
27
+ # if the equipment exist, add password and enable password
28
+ elsif line[i] == 'password'
30
29
  if hash[line[i + 1]]
31
30
  if line.length > i + 2
32
31
  h = hash[line[i + 1]]
@@ -47,16 +46,17 @@ module Oxidized
47
46
  close_file.close
48
47
  hash
49
48
  end
49
+
50
50
  def model_dico model
51
- dico = {"cisco"=>"ios", "foundry"=>"ironware"}
52
- model = model.gsub("\n", "")
51
+ dico = { 'cisco' => 'ios', 'foundry' => 'ironware' }
52
+ model = model.gsub("\n", '')
53
53
  if dico[model]
54
54
  model = dico[model]
55
55
  end
56
56
  model
57
57
  end
58
-
59
- #add node and group for an equipment (take a list of router.db)
58
+
59
+ # add node and group for an equipment (take a list of router.db)
60
60
  def rancid_group router_db_list
61
61
  model = {}
62
62
  hash = cloginrc @cloginrc
@@ -64,11 +64,11 @@ module Oxidized
64
64
  group = router_db[:group]
65
65
  file_close = router_db[:file]
66
66
  file = file_close.read
67
- file = file.gsub(":up", '')
68
- file.gsub(" ", '')
69
-
67
+ file = file.gsub(':up', '')
68
+ file.gsub(' ', '')
69
+
70
70
  file.each_line do |line|
71
- line = line.split(":")
71
+ line = line.split(':')
72
72
  node = line[0]
73
73
  if hash[node]
74
74
  h = hash[node]
@@ -82,25 +82,25 @@ module Oxidized
82
82
  hash
83
83
  end
84
84
 
85
- #write a router.db conf, need the hash and the path of the file we whish create
85
+ # write a router.db conf, need the hash and the path of the file we whish create
86
86
  def write_router_db hash
87
- router_db = File.new(@path_new_router, "w")
87
+ router_db = File.new(@path_new_router, 'w')
88
88
  hash.each do |key, value|
89
89
  line = key.to_s
90
- line += ":" + value[:model].to_s
91
- line += ":" + value[:user].to_s
92
- line += ":" + value[:password].to_s
93
- line += ":" + value[:group].to_s
90
+ line += ":#{value[:model]}"
91
+ line += ":#{value[:user]}"
92
+ line += ":#{value[:password]}"
93
+ line += ":#{value[:group]}"
94
94
  if value[:enable]
95
- line += ":" + value[:enable].to_s
95
+ line += ":#{value[:enable]}"
96
96
  end
97
97
  router_db.puts(line)
98
98
  end
99
99
  router_db.close
100
100
  end
101
-
101
+
102
102
  def edit_conf_file path_conf, router_db_path
103
- file_close = File.open(path_conf, "r")
103
+ file_close = File.open(path_conf, 'r')
104
104
  file = file_close
105
105
  file = file.read
106
106
  source_reached = false
@@ -117,7 +117,7 @@ module Oxidized
117
117
  source_reached = true
118
118
  new_file.push(" default: csv\n")
119
119
  new_file.push(" csv:\n")
120
- new_file.push(" file: " + router_db_path + "\n")
120
+ new_file.push(" file: #{router_db_path}\n")
121
121
  new_file.push(" delimiter: !ruby/regexp /:/\n")
122
122
  new_file.push(" map:\n")
123
123
  new_file.push(" name: 0\n")
@@ -131,14 +131,14 @@ module Oxidized
131
131
  end
132
132
  end
133
133
  file_close.close
134
-
134
+
135
135
  new_conf = File.new(path_conf, "w")
136
136
  new_file.each do |line|
137
137
  new_conf.puts(line)
138
138
  end
139
139
  new_conf.close
140
140
  end
141
-
141
+
142
142
  def go_rancid_migration
143
143
  hash = rancid_group @hash_router_db
144
144
  write_router_db hash
@@ -0,0 +1 @@
1
+ div.dt-button-info{position:fixed;top:50%;left:50%;width:400px;margin-top:-100px;margin-left:-200px;background-color:white;border:2px solid #111;box-shadow:3px 3px 8px rgba(0,0,0,0.3);border-radius:3px;text-align:center;z-index:21}div.dt-button-info h2{padding:0.5em;margin:0;font-weight:normal;border-bottom:1px solid #ddd;background-color:#f3f3f3}div.dt-button-info>div{padding:1em}ul.dt-button-collection.dropdown-menu{display:block;z-index:2002;-webkit-column-gap:8px;-moz-column-gap:8px;-ms-column-gap:8px;-o-column-gap:8px;column-gap:8px}ul.dt-button-collection.dropdown-menu.fixed{position:fixed;top:50%;left:50%;margin-left:-75px;border-radius:0}ul.dt-button-collection.dropdown-menu.fixed.two-column{margin-left:-150px}ul.dt-button-collection.dropdown-menu.fixed.three-column{margin-left:-225px}ul.dt-button-collection.dropdown-menu.fixed.four-column{margin-left:-300px}ul.dt-button-collection.dropdown-menu>*{-webkit-column-break-inside:avoid;break-inside:avoid}ul.dt-button-collection.dropdown-menu.two-column{width:300px;padding-bottom:1px;-webkit-column-count:2;-moz-column-count:2;-ms-column-count:2;-o-column-count:2;column-count:2}ul.dt-button-collection.dropdown-menu.three-column{width:450px;padding-bottom:1px;-webkit-column-count:3;-moz-column-count:3;-ms-column-count:3;-o-column-count:3;column-count:3}ul.dt-button-collection.dropdown-menu.four-column{width:600px;padding-bottom:1px;-webkit-column-count:4;-moz-column-count:4;-ms-column-count:4;-o-column-count:4;column-count:4}div.dt-button-background{position:fixed;top:0;left:0;width:100%;height:100%;z-index:2001}@media screen and (max-width: 767px){div.dt-buttons{float:none;width:100%;text-align:center;margin-bottom:0.5em}div.dt-buttons a.btn{float:none}}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Bootstrap v3.2.0 (http://getbootstrap.com)
3
+ * Copyright 2011-2014 Twitter, Inc.
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5
+ */
6
+ if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.2.0",d.prototype.close=function(b){function c(){f.detach().trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",c).emulateTransitionEnd(150):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.2.0",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),d[e](null==f[b]?this.options[b]:f[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b).on("keydown.bs.carousel",a.proxy(this.keydown,this)),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.2.0",c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},c.prototype.keydown=function(a){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.to=function(b){var c=this,d=this.getItemIndex(this.$active=this.$element.find(".item.active"));return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=e[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:g});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,f&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(e)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:g});return a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one("bsTransitionEnd",function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger(m)),f&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b);!e&&f.toggle&&"show"==b&&(b=!b),e||d.data("bs.collapse",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};c.VERSION="3.2.0",c.DEFAULTS={toggle:!0},c.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},c.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var c=a.Event("show.bs.collapse");if(this.$element.trigger(c),!c.isDefaultPrevented()){var d=this.$parent&&this.$parent.find("> .panel > .in");if(d&&d.length){var e=d.data("bs.collapse");if(e&&e.transitioning)return;b.call(d,"hide"),e||d.data("bs.collapse",null)}var f=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[f](0),this.transitioning=1;var g=function(){this.$element.removeClass("collapsing").addClass("collapse in")[f](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return g.call(this);var h=a.camelCase(["scroll",f].join("-"));this.$element.one("bsTransitionEnd",a.proxy(g,this)).emulateTransitionEnd(350)[f](this.$element[0][h])}}},c.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},c.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var d=a.fn.collapse;a.fn.collapse=b,a.fn.collapse.Constructor=c,a.fn.collapse.noConflict=function(){return a.fn.collapse=d,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(c){var d,e=a(this),f=e.attr("data-target")||c.preventDefault()||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),g=a(f),h=g.data("bs.collapse"),i=h?"toggle":e.data(),j=e.attr("data-parent"),k=j&&a(j);h&&h.transitioning||(k&&k.find('[data-toggle="collapse"][data-parent="'+j+'"]').not(e).addClass("collapsed"),e[g.hasClass("in")?"addClass":"removeClass"]("collapsed")),b.call(g,i)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.2.0",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.divider):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f+', [role="menu"], [role="listbox"]',g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$backdrop=this.isShown=null,this.scrollbarWidth=0,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.2.0",c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.$body.addClass("modal-open"),this.setScrollbar(),this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(c.$body),c.$element.show().scrollTop(0),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one("bsTransitionEnd",function(){c.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(300):c.$element.trigger("focus").trigger(e)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.$body.removeClass("modal-open"),this.resetScrollbar(),this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;if(this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;e?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(150):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var f=function(){c.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",f).emulateTransitionEnd(150):f()}else b&&b()},c.prototype.checkScrollbar=function(){document.body.clientWidth>=window.innerWidth||(this.scrollbarWidth=this.scrollbarWidth||this.measureScrollbar())},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};c.VERSION="3.2.0",c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var c=a.contains(document.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!c)return;var d=this,e=this.tip(),f=this.getUID(this.type);this.setContent(),e.attr("id",f),this.$element.attr("aria-describedby",f),this.options.animation&&e.addClass("fade");var g="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,h=/\s?auto?\s?/i,i=h.test(g);i&&(g=g.replace(h,"")||"top"),e.detach().css({top:0,left:0,display:"block"}).addClass(g).data("bs."+this.type,this),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element);var j=this.getPosition(),k=e[0].offsetWidth,l=e[0].offsetHeight;if(i){var m=g,n=this.$element.parent(),o=this.getPosition(n);g="bottom"==g&&j.top+j.height+l-o.scroll>o.height?"top":"top"==g&&j.top-o.scroll-l<0?"bottom":"right"==g&&j.right+k>o.width?"left":"left"==g&&j.left-k<o.left?"right":g,e.removeClass(m).addClass(g)}var p=this.getCalculatedOffset(g,j,k,l);this.applyPlacement(p,g);var q=function(){d.$element.trigger("shown.bs."+d.type),d.hoverState=null};a.support.transition&&this.$tip.hasClass("fade")?e.one("bsTransitionEnd",q).emulateTransitionEnd(150):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top=b.top+g,b.left=b.left+h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=k.left?2*k.left-e+i:2*k.top-f+j,m=k.left?"left":"top",n=k.left?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(l,d[0][n],m)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach(),c.$element.trigger("hidden.bs."+c.type)}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.removeAttr("aria-describedby"),this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one("bsTransitionEnd",b).emulateTransitionEnd(150):b(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName;return a.extend({},"function"==typeof c.getBoundingClientRect?c.getBoundingClientRect():null,{scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop(),width:d?a(window).width():b.outerWidth(),height:d?a(window).height():b.outerHeight()},d?{top:0,left:0}:b.offset())},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.2.0",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").empty()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},c.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){var e=a.proxy(this.process,this);this.$body=a("body"),this.$scrollElement=a(a(c).is("body")?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.2.0",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b="offset",c=0;a.isWindow(this.$scrollElement[0])||(b="position",c=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var d=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+c,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){d.offsets.push(this[0]),d.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.2.0",c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.closest("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},c.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one("bsTransitionEnd",e).emulateTransitionEnd(150):e(),f.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(c){c.preventDefault(),b.call(a(this),"show")})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.2.0",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=a(document).height(),d=this.$target.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=b-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){null!=this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:b-this.$element.height()-h}))}}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},d.offsetBottom&&(d.offset.bottom=d.offsetBottom),d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
@@ -0,0 +1,76 @@
1
+ // Add a line for a new file to upload
2
+ var add_file_upload = function() {
3
+ var rancidDbDiv = $("div[id^='rancidDb']:last");
4
+ var num = parseInt(rancidDbDiv.prop("id").match(/\d+/g)) + 1;
5
+ rancidDbDiv.clone(true)
6
+ .prop("id", "rancidDb" + num)
7
+ .insertAfter(rancidDbDiv);
8
+ $("input[id^='file']:last")
9
+ .prop("id", "file" + num)
10
+ .prop("name", "file" + num)
11
+ .parents('.input-group')
12
+ .find(':text')
13
+ .val('');
14
+ $("input[id^='group']:last")
15
+ .prop("id", "group" + num)
16
+ .prop("name", "group" + num);
17
+ };
18
+
19
+ var onFileSelected = function() {
20
+ $(document).on('change', '.btn-file :file', function() {
21
+ var input = $(this),
22
+ numFiles = input.get(0).files ? input.get(0).files.length : 1,
23
+ label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
24
+ input.trigger('fileSelect', [numFiles, label]);
25
+ });
26
+ };
27
+
28
+ // fix colvis buttons
29
+ var fixColVisBtn = function() {
30
+ $('.ColVis_Button').each(function() {
31
+ $(this).addClass('btn btn-default');
32
+ });
33
+ $('.ColVis_MasterButton').each(function() {
34
+ $(this).addClass('pull-right');
35
+ });
36
+ };
37
+
38
+ var convertTime = function() {
39
+ /* Convert UTC times to local browser times
40
+ * Requires that the times on the server are UTC
41
+ * Requires a class name of `time` to be set on element desired to be changed
42
+ * Requires that element have a text in the format of `YYYY-mm-dd HH:MM:SS`
43
+ * See ytti/oxidized-web #16
44
+ */
45
+ $('.time').each(function() {
46
+ var content = $(this).text();
47
+ if(content === 'never') { return; }
48
+ var utcTime = content.split(' ');
49
+ var date = new Date(utcTime[0] + 'T' + utcTime[1] + 'Z');
50
+ var year = date.getFullYear();
51
+ var month = ("0"+(date.getMonth()+1)).slice(-2);
52
+ var day = ("0" + date.getDate()).slice(-2);
53
+ var hour = ("0" + date.getHours()).slice(-2);
54
+ var minute = ("0" + date.getMinutes()).slice(-2);
55
+ var second = ("0" + date.getSeconds()).slice(-2);
56
+ var timeZone = date.toString().match(/\(.*\)/)[0].match(/[A-Z]/g).join('');
57
+ $(this).text(year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second + ' ' + timeZone);
58
+ });
59
+ };
60
+
61
+ $(function() {
62
+ onFileSelected();
63
+ fixColVisBtn();
64
+ convertTime();
65
+ // Add a row to the migration form
66
+ $("#add").click(function() {
67
+ add_file_upload();
68
+ });
69
+
70
+ // Updates textbox with filename on fileSelect event
71
+ $('.btn-file :file').on('fileSelect', function(e, numFiles, label) {
72
+ $(this).parents('.input-group').find(':text').val(label);
73
+ });
74
+ });
75
+
76
+
@@ -1,43 +1,36 @@
1
- %script{:src=>url_for('/scripts/jquery-2.1.1.min.js')}
2
- %script{:src=>url_for('/scripts/jquery.dataTables.min.js')}
3
- %script{:src=>url_for('/scripts/dataTables.bootstrap.js')}
4
- %script{:src=>url_for('/scripts/dataTables.colVis.js')}
5
- %link{:rel=>'stylesheet', :href=>url_for('/css/dataTables.bootstrap.css')}
6
- %link{:rel=>'stylesheet', :href=>url_for('/css/dataTables.colVis.css')}
1
+ .row.tbl-header
2
+ .col-xs-12
3
+ %h4
4
+ %a{href: url_for('/nodes')} nodes
5
+ \/ Nodes that contain
6
+ %span "#{@to_research}"
7
+
8
+ .row
9
+ .pull-right
10
+ %form
11
+ %button.ColVis_Button{type: 'button', onclick: 'history.go();'}
12
+ %span.glyphicon.glyphicon-repeat Refresh
13
+ .table-responsive
14
+ %table.table.table-condensed.table-striped.table-hover#versionsTable
15
+ %thead
16
+ %tr
17
+ %th Name
18
+ %th Configuration
19
+
20
+ %tbody
21
+ - @nodes_match.each do |x|
22
+ %tr
23
+ %td #{x[:node]}
24
+ %td
25
+ %a{title: 'configuration',
26
+ href: url_for("/node/fetch/#{x[:full_name]}")}
27
+ %span.glyphicon.glyphicon-cloud-download
28
+
7
29
  :javascript
8
30
  $(function() {
9
31
  $('#versionsTable').dataTable({
10
32
  dom: 'C<"clear">lfrtip',
11
- "order": [[ 0, "desc" ]]
33
+ "order": [[0, "desc"]]
12
34
  });
13
35
  });
14
- %div{:class=>'row tbl-header'}
15
- %div{:class=>'col-xs-12 '}
16
- %h4
17
- %a{:href=>url_for('/nodes')} nodes
18
- \/ Nodes that contain
19
- %span " #{@to_research} "
20
-
21
- %div{:class=>'row'}
22
- %div{:class=>'refresh-div'}
23
- %form
24
- %button{:class => "ColVis_Button", :type => "button", :onclick => "history.go();"}
25
- %span{:class=>"glyphicon glyphicon-repeat"}
26
- Refresh
27
- %table{:id=>'versionsTable', :class=>'table table-responsive tablesorter'}
28
- %thead
29
- %tr
30
- %th Name
31
- %th Configuration
32
-
33
- %tbody
34
- -trclass = %w(even odd)
35
- - @nodes_match.each do |x|
36
- %tr
37
- %td
38
- #{x[:node]}
39
- %td
40
- %a{:title => "configuration", :href => url_for("/node/fetch/#{x[:full_name]}") }
41
- %span{:class=>'glyphicon glyphicon-cloud-download'}
42
36
 
43
-
@@ -1,69 +1,84 @@
1
- !=haml :head
2
- %body
3
- %h4
4
- - node_full = ''
5
- - if @info[:group] != ''
6
- - node_full = "#{@info[:group] + '/' + @info[:node]}"
7
- - else
8
- - node_full = "#{@info[:node]}"
9
- %a{:href=>url_for("/node/version?node_full=#{node_full}")} versions
10
- \/ Diff version #{@info[:num]} - #{@info[:num2]} for Node
11
- %span{:class=>'node_title'} #{@info[:node]}
12
- - date_version = Time.parse @info[:date]
13
- Date of version: #{date_version.strftime("%d-%m-%y at %r")}
14
- %br
15
- Number of lines changed:
16
- %span{:class=>'added'}added #{@stat[0]}
17
- %span{:class=>'deleted'}removed #{@stat[1]}
18
- %br
19
- %br
20
- %form{ :action => "/node/version/diffs?node=#{@info[:node]}&group=#{@info[:group]}&oid=#{@info[:oid]}&date=#{@info[:date]}&num=#{@info[:num]}", :method => "post"}
21
- %select{:name => "oid2", :id => "oid2"}
22
- - diff2 = {}
23
- - num = @oids_dates.count + 1
24
- - next_id = false
25
- - @oids_dates.each do |x|
26
- %option{:value => x[:oid]} Version #{num -= 1} (#{time_from_now x[:date]})
27
- - if (x[:oid].to_s == @info[:oid2]) || (next_id)
28
- - diff2 = {:num => num, :date => x[:date]}
1
+ .row
2
+ .col-sm-12
3
+ %h4
4
+ - if @info[:group] != ''
5
+ - node_full = "#{@info[:group]}/#{@info[:node]}"
6
+ - else
7
+ - node_full = "#{@info[:node]}"
8
+ %a{href: url_for("/node/version?node_full=#{node_full}")} versions
9
+ \/ Diff version #{@info[:num]} - #{@info[:num2]} for Node
10
+ %span.node_title #{@info[:node]}
11
+ .row
12
+ .col-sm-12
13
+ - date_version = Time.parse @info[:date]
14
+ Date of version:
15
+ %span.time #{date_version.strftime("%d-%m-%y at %r")}
16
+ .row
17
+ .col-sm-12
18
+ Number of lines changed:
19
+ %span.added added #{@stat[0]}
20
+ %span.deleted removed #{@stat[1]}
21
+
22
+ .row
23
+ .col-sm-6
24
+ - params = "node=#{@info[:node]}&group=#{@info[:group]}&oid=#{@info[:oid]}"
25
+ - params = "#{params}&date=#{@info[:date]}&num=#{@info[:num]}"
26
+ %form{action: "/node/version/diffs?#{params}", method: 'post', role: 'form'}
27
+ .form-group
28
+ %select.form-control#oid2{name: 'oid2'}
29
+ - diff2 = {}
30
+ - num = @oids_dates.count + 1
29
31
  - next_id = false
30
- - elsif (x[:oid].to_s == @info[:oid]) && !(@info[:oid2])
31
- - next_id = true
32
-
33
-
34
- %input{:type => "submit", :value => "Get diffs !"}
35
- %br
36
- %div{:class=>'old_version_title'} Version #{diff2[:num]} (#{time_from_now diff2[:date]})
32
+ - @oids_dates.each do |x|
33
+ %option{value: x[:oid]} Version #{num -= 1} (#{time_from_now x[:date]})
34
+ - if (x[:oid].to_s == @info[:oid2]) || (next_id)
35
+ - diff2 = {num: num, date: x[:date]}
36
+ - next_id = false
37
+ - elsif (x[:oid].to_s == @info[:oid]) && !(@info[:oid2])
38
+ - next_id = true
39
+
40
+ %button.btn.btn-default{type: 'submit'} Get Diffs!
41
+
42
+ .row
43
+ .col-sm-12
44
+ .old_version_title Version #{diff2[:num]} (#{time_from_now diff2[:date]})
45
+ .new_version_title Version #{@info[:num]} (#{time_from_now @info[:date]})
46
+
47
+ .row
48
+ .col-sm-12
49
+ .diffs_old
50
+ - @diff[:old_diff].each do |line|
51
+ - if /^\+.*/.match(line)
52
+ .added> #{line}
53
+
54
+ - elsif /^\-.*/.match(line)
55
+ .deleted> #{line}
56
+
57
+ - elsif /^@@\s.*@@.*$/.match(line)
58
+ .diff-index> #{line}
59
+
60
+ - elsif /^empty_line&nbsp;/.match(line)
61
+ - line.slice! "empty_line"
62
+ .diff-empty> #{line}
63
+
64
+ - else
65
+ %div> #{line}
66
+
67
+ .diffs_new
68
+ - @diff[:new_diff].each do |line|
69
+ - if /^\+.*/.match(line)
70
+ .added> #{line}
71
+
72
+ - elsif /^\-.*/.match(line)
73
+ .deleted> #{line}
74
+
75
+ - elsif /^@@\s.*@@.*$/.match(line)
76
+ .diff-index> #{line}
77
+
78
+ - elsif /^empty_line&nbsp;/.match(line)
79
+ - line.slice! "empty_line"
80
+ .diff-empty> #{line}
81
+
82
+ - else
83
+ %div> #{line}
37
84
 
38
- %div{:class=>'new_version_title'} Version #{@info[:num]} (#{time_from_now @info[:date]})
39
- %br
40
- %div{:class=>'diffs_old', :id=>'Test'}
41
- - @diff[:old_diff].each do |line|
42
- - if /^\+.*/.match(line)
43
- %div{:class=>'added',:id=>'Test'} #{line}
44
-
45
- - elsif /^\-.*/.match(line)
46
- %div{:class=>'deleted'} #{line}
47
-
48
- - elsif /^@@\s.*@@.*$/.match(line)
49
- %div{:class=>'diff-index', :id=>'Test'} #{line}
50
- - elsif /^empty_line&nbsp;/.match(line)
51
- - line.slice! "empty_line"
52
- %div{:class=>'diff-empty'} #{line}
53
- - else
54
- %div #{line}
55
- %div{:class=>'diffs_new'}
56
- - @diff[:new_diff].each do |line|
57
- - if /^\+.*/.match(line)
58
- %div{:class=>'added'} #{line}
59
-
60
- - elsif /^\-.*/.match(line)
61
- %div{:class=>'deleted'} #{line}
62
-
63
- - elsif /^@@\s.*@@.*$/.match(line)
64
- %div{:class=>'diff-index'} #{line}
65
- - elsif /^empty_line&nbsp;/.match(line)
66
- - line.slice! "empty_line"
67
- %div{:class=>'diff-empty'} #{line}
68
- - else
69
- %div #{line}