localtower 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98c3c4c208483d3e1a6b632be3904733e6040bc8
4
- data.tar.gz: ffd6958119fdb2a9ab83e913e57d341e1ee08b6d
3
+ metadata.gz: 637dbbe42bd8f65af574ef7aacba42fd05c8e656
4
+ data.tar.gz: 87b37967db9f201cafe56d5ec4263f642280fb62
5
5
  SHA512:
6
- metadata.gz: 582f8bb98e76c22706882790614ef4b75d7dbb07dcf260f843f50bb19e1aa464c016b93d74977b5d519c89312161f31e500b0dd3d1e3758580ba86f20b2fb4ed
7
- data.tar.gz: f44173b50775840aceab727dfb56aaa4e41a6a77585d8a3bcaf702eea1ff6f402e6b85e6fe7822b290be7c5f785f0dfa01a22fc19d83ffe0a6be0e1582a4b736
6
+ metadata.gz: 6b8c92dbbf31ca81efdaec1c003628cb23fd17b1004e28adb61989d2a88fce88b84f4ce510f05ce0c70173b2c433c3b6b5e35a754052e873f966771d5e35ad7a
7
+ data.tar.gz: b33d71126afdd200279f1f6c2d51c1f0d6535227625ec91d784363ec05f279f88d470d1c2cb460186dd520b381f4fab983c476ebf2d12d029e92157132930f46
@@ -6,6 +6,10 @@ module Localtower
6
6
  def dashboard
7
7
  end
8
8
 
9
+ def status
10
+ @data = ::Localtower::Status.new.run
11
+ end
12
+
9
13
  def migrations
10
14
  end
11
15
 
@@ -56,6 +56,15 @@
56
56
  <p>New Migration</p>
57
57
  </a>
58
58
  </li>
59
+ <!--
60
+ <li class="<%= is_active_link?(status_path, :inclusive) ? "active" : nil %>">
61
+ <a href="<%= status_path %>">
62
+ <i class=""></i>
63
+ <p>Status</p>
64
+ </a>
65
+ </li>
66
+ -->
67
+
59
68
  </ul>
60
69
  </div>
61
70
  </div>
@@ -80,7 +89,7 @@
80
89
  <br>
81
90
  <br>
82
91
  <p>
83
- If you're seeing an error message on the next age, just run:
92
+ If you're seeing an error message on the next page (pending migrations), just run in your terminal:
84
93
  <br>
85
94
  <br>
86
95
  <code>bundle exec rails db:migrate</code>
@@ -98,6 +107,7 @@
98
107
 
99
108
  <!-- Light Bootstrap Table Core javascript and methods for Demo purpose -->
100
109
  <script src="/light-bootstrap-dashboard-master/assets/js/light-bootstrap-dashboard.js"></script>
110
+ <script src="/js/masonry.pkgd.min.js"></script>
101
111
  <script src="/js/app.js"></script>
102
112
  </body>
103
113
  </html>
@@ -2,23 +2,24 @@
2
2
 
3
3
  <div class="row">
4
4
  <div class="col-md-12">
5
- <div class="card">
6
- <div class="header">
7
- <h4 class="title"></h4>
8
- </div>
5
+ <div class="content">
6
+ <div class="">
9
7
 
10
- <div class="content">
11
- <div class="row">
8
+ <div class="grid">
9
+ <div class="grid-sizer"></div>
12
10
 
13
11
  <% ::Localtower::Tools.models_presented.each do |model| %>
14
12
 
15
- <div class="col-md-6">
16
- <h3><%= model[:name] %></h3>
13
+ <div class="grid-item text-small card">
14
+ <div class="text-center">
15
+ <h5><%= model[:name] %></h5>
16
+ </div>
17
17
 
18
- <table class="table table-hover table-striped">
18
+ <table class="table table-hover table-striped table-condensed">
19
19
  <thead>
20
20
  <th>Field</th>
21
21
  <th>Type</th>
22
+ <th>Belongs To</th>
22
23
  <th>Index?</th>
23
24
  </thead>
24
25
 
@@ -36,9 +37,19 @@
36
37
  <%= attribute_data["type_clean"] %>
37
38
  </td>
38
39
 
40
+ <td>
41
+ <% if attribute_data["belongs_to"] %>
42
+ <span class="label label-primary">
43
+ <%= attribute_data["belongs_to"] %>
44
+ </span>
45
+ <% end %>
46
+ </td>
47
+
39
48
  <td>
40
49
  <% if attribute_data["index"].any? %>
41
- <span class="label label-primary">Yes</span>
50
+ <span class="label label-success">Yes</span>
51
+ <% else %>
52
+ <span class="label label-default">No</span>
42
53
  <% end %>
43
54
  </td>
44
55
  </tr>
@@ -47,8 +58,9 @@
47
58
  </table>
48
59
  </div>
49
60
  <% end %>
50
-
61
+ <div class="clearfix"></div>
51
62
  </div>
63
+
52
64
  </div>
53
65
  </div>
54
66
  </div>
@@ -12,29 +12,29 @@
12
12
 
13
13
  <table class="table table-hover table-striped">
14
14
  <thead>
15
- <th>Action</th>
16
- <th>Model</th>
17
- <th>Belongs To</th>
18
- <th>Column</th>
19
- <th>New Column Name</th>
20
- <th>Type</th>
21
- <th>Index?</th>
22
- <th>Can be null?</th>
23
- <th></th>
15
+ <th> <span data-selector=''>On Model</span></th>
16
+ <th> <span data-selector=''>Action</span></th>
17
+ <th> <span data-selector='belongs_to_label'>Belongs To</span></th>
18
+ <th> <span data-selector='column_label'>Column</span></th>
19
+ <th> <span data-selector='new_column_name_label'>New Column Name</span></th>
20
+ <th> <span data-selector='column_type_label'>Type</span></th>
21
+ <th> <span data-selector='index_label'>Index?</span></th>
22
+ <th> <span data-selector='nullable_label'>Can be null?</span></th>
23
+ <th> <span data-selector=''></span></th>
24
24
  </thead>
25
25
 
26
26
  <tbody data-selector="tbody">
27
27
  <tr data-selector="tr">
28
28
  <td>
29
- <%= select_tag "migrations[migrations][][action]", options_for_select(::Localtower::Generators::Migration::ACTIONS), class: "form-control", "data-selector" => "action" %>
29
+ <%= select_tag "migrations[migrations][][table_name]", options_for_select(Localtower::Tools.models.collect {|p| [ p, p.table_name ] }), class: "form-control" %>
30
30
  </td>
31
31
 
32
32
  <td>
33
- <%= select_tag "migrations[migrations][][table_name]", options_for_select(Localtower::Tools.models.collect {|p| [ p, p.table_name ] }), class: "form-control" %>
33
+ <%= select_tag "migrations[migrations][][action]", options_for_select(::Localtower::Generators::Migration::ACTIONS), class: "form-control", "data-selector" => "action" %>
34
34
  </td>
35
35
 
36
36
  <td>
37
- <%= select_tag "migrations[migrations][][belongs_to]", options_for_select(Localtower::Tools.models.collect {|p| [ p, p.table_name ] }), class: "form-control" %>
37
+ <%= select_tag "migrations[migrations][][belongs_to]", options_for_select(Localtower::Tools.models.collect {|p| [ p, p.table_name ] }), class: "form-control", "data-selector" => "belongs_to" %>
38
38
  </td>
39
39
 
40
40
  <td class="text-center">
@@ -44,19 +44,19 @@
44
44
  </td>
45
45
 
46
46
  <td>
47
- <input type="text" name="migrations[migrations][][new_column_name]" class="form-control">
47
+ <input type="text" name="migrations[migrations][][new_column_name]" class="form-control" data-selector="new_column_name">
48
48
  </td>
49
49
 
50
50
  <td>
51
- <%= select_tag "migrations[migrations][][column_type]", options_for_select(::Localtower::Generators::Migration::TYPES), class: "form-control" %>
51
+ <%= select_tag "migrations[migrations][][column_type]", options_for_select(::Localtower::Generators::Migration::TYPES), class: "form-control", "data-selector" => "column_type" %>
52
52
  </td>
53
53
 
54
54
  <td>
55
- <input type="checkbox" name="migrations[migrations][][index]" class="form-control">
55
+ <input type="checkbox" name="migrations[migrations][][index]" class="form-control" data-selector="index">
56
56
  </td>
57
57
 
58
58
  <td>
59
- <input type="checkbox" name="migrations[migrations][][nullable]" class="form-control" checked="">
59
+ <input type="checkbox" name="migrations[migrations][][nullable]" class="form-control" checked="" data-selector="nullable">
60
60
  </td>
61
61
 
62
62
  <td>
@@ -0,0 +1,29 @@
1
+ <% content_for :title do %>Status<% end %>
2
+
3
+ <div class="row">
4
+ <div class="col-md-12">
5
+ <div class="card">
6
+ <div class="header">
7
+ <h4 class="title"></h4>
8
+ </div>
9
+
10
+ <div class="content">
11
+ <table class="table">
12
+ <% @data.each do |entry| %>
13
+ <tr>
14
+ <%
15
+ klass = ""
16
+ klass = (entry["status"] == 1) ? "success" : nil
17
+ klass = (entry["status"] == 0) ? "danger" : klass
18
+
19
+ %>
20
+ <td class="<%= klass %>">
21
+ <%= entry["name"] %>
22
+ </td>
23
+ </tr>
24
+ <% end %>
25
+ </table>
26
+ </div>
27
+ </div>
28
+ </div>
29
+ </div>
data/config/routes.rb CHANGED
@@ -8,6 +8,7 @@ Localtower::Engine.routes.draw do
8
8
  get "relations", to: "pages#relations", as: :relations
9
9
  post "relations", to: "pages#post_relations"
10
10
 
11
+ get "status", to: "pages#status", as: :status
11
12
  # get ':v/:asset', to: 'pages#asset_render', as: 'asset_render', :constraints => { :v => /[^\/]*/, :asset => /[^\/]*/ }
12
13
 
13
14
  get 'dashboard', to: 'pages#dashboard', as: 'dashboard'
@@ -0,0 +1,30 @@
1
+ module Localtower
2
+ class Status
3
+ def run
4
+ files = Dir["#{Rails.root}/db/migrate/*.rb"].sort.reverse
5
+
6
+ names = files.map do |file_full_path|
7
+ file_full_path.split("/")[-1]
8
+ end
9
+
10
+ results = []
11
+
12
+ migrations = ActiveRecord::Base.connection.execute("select * from schema_migrations;").map { |e| e["version"].to_s }.sort.reverse
13
+
14
+ names.each do |name|
15
+ number = name.split("_")[0]
16
+
17
+ status = migrations.include?(number) ? 1 : 0
18
+
19
+ data = {
20
+ "name" => name,
21
+ "status" => status,
22
+ }
23
+
24
+ results << data
25
+ end
26
+
27
+ results
28
+ end
29
+ end
30
+ end
@@ -43,9 +43,17 @@ module Localtower
43
43
  attributes_list = []
44
44
 
45
45
  model.columns_hash.each do |_k, v|
46
+
47
+ belongs_to = nil
48
+
49
+ if v.name.strip =~ /\_id$/
50
+ belongs_to = v.name.strip.gsub(/_id$/, "").singularize.camelize
51
+ end
52
+
46
53
  attributes_list << {
47
54
  'name' => v.name.strip,
48
55
  'type' => v.sql_type.strip,
56
+ 'belongs_to' => belongs_to,
49
57
  'type_clean' => v.sql_type.split(' ')[0].strip,
50
58
  'primary' => (v.respond_to?(:primary) ? v.primary : false),
51
59
  'index' => self.indexes_for_model_and_attribute(model, v.name),
@@ -1,3 +1,3 @@
1
1
  module Localtower
2
- VERSION = '0.1.5'.freeze
2
+ VERSION = '0.1.6'.freeze
3
3
  end
data/public/css/app.css CHANGED
@@ -27,3 +27,17 @@
27
27
  -webkit-animation: spin 1s infinite linear;
28
28
  font-size: 4em;
29
29
  }
30
+
31
+ /*=========================*/
32
+
33
+
34
+ .table-condensed>tbody>tr>td, .table-condensed>tbody>tr>th, .table-condensed>tfoot>tr>td, .table-condensed>tfoot>tr>th, .table-condensed>thead>tr>td, .table-condensed>thead>tr>th {
35
+ padding: 5px;
36
+ }
37
+
38
+
39
+ .grid-sizer, .grid-item {
40
+ box-sizing: border-box;
41
+ width: 45%;
42
+ margin: 2%;
43
+ }
data/public/js/app.js CHANGED
@@ -27,6 +27,12 @@ MainApp = {
27
27
  });
28
28
 
29
29
  MainApp.adaptLines();
30
+
31
+ $('.grid').masonry({
32
+ itemSelector: '.grid-item',
33
+ percentPosition: true,
34
+ columnWidth: '.grid-sizer',
35
+ });
30
36
  },
31
37
 
32
38
  // INSTANCE
@@ -37,35 +43,95 @@ MainApp = {
37
43
  $.each(MainApp.bySelector("tr"), function() {
38
44
  var $tr = $(this);
39
45
 
40
- var action_input = $tr.find("[name='migrations[migrations][][action]']");
46
+ var action_input = $tr.find("[data-selector='action']");
47
+ var action = action_input.val();
41
48
 
42
- var table_name_input = $tr.find("[name='migrations[migrations][][table_name]']");
43
- var belongs_to_input = $tr.find("[name='migrations[migrations][][belongs_to]']");
49
+ var belongs_to_input = $tr.find("[data-selector='belongs_to']");
50
+ var belongs_to_label = MainApp.bySelector('belongs_to_label');
44
51
 
45
52
  var column_text_input = $tr.find("[data-selector='column_text']");
53
+ var column_text_label = MainApp.bySelector('column_text_label');
54
+
46
55
  var column_input = $tr.find("[data-selector='column_list']");
56
+ var column_label = MainApp.bySelector('column_label');
47
57
 
48
- var new_column_name_input = $tr.find("[name='migrations[migrations][][new_column_name]']");
49
- var column_type_input = $tr.find("[name='migrations[migrations][][column_type]']");
50
- var index_input = $tr.find("[name='migrations[migrations][][index]']");
51
- var nullable_input = $tr.find("[name='migrations[migrations][][nullable]']");
58
+ var new_column_name_input = $tr.find("[data-selector='new_column_name']");
59
+ var new_column_name_label = MainApp.bySelector('new_column_name_label');
52
60
 
53
- var action = action_input.val();
61
+ var column_type_input = $tr.find("[data-selector='column_type']");
62
+ var column_type_label = MainApp.bySelector('column_type_label');
63
+
64
+ var index_input = $tr.find("[data-selector='index']");
65
+ var index_label = MainApp.bySelector('index_label');
66
+
67
+ var nullable_input = $tr.find("[data-selector='nullable']");
68
+ var nullable_label = MainApp.bySelector('nullable_label');
54
69
 
70
+ $.each(
71
+ [
72
+ belongs_to_input,
73
+ belongs_to_label,
55
74
 
56
- $.each([belongs_to_input, column_text_input, column_input, new_column_name_input, column_type_input, index_input, nullable_input], function(i, el) {
75
+ column_text_input,
76
+ column_text_label,
77
+
78
+ column_input,
79
+ column_label,
80
+
81
+ new_column_name_input,
82
+ new_column_name_label,
83
+
84
+ column_type_input,
85
+ column_type_label,
86
+
87
+ index_input,
88
+ index_label,
89
+
90
+ nullable_input,
91
+ nullable_label,
92
+ ], function(i, el) {
57
93
  el.hide();
58
94
  });
59
95
 
60
-
61
96
  var mapping = {
62
- add_column: [column_text_input, column_type_input, index_input, nullable_input],
63
- remove_column: [column_input],
64
- rename_column: [column_input, new_column_name_input],
65
- change_column_type: [column_input, column_type_input],
66
- belongs_to: [belongs_to_input],
67
- add_index_to_column: [column_input],
68
- remove_index_to_column: [column_input],
97
+ add_column: [
98
+ column_text_input,
99
+ column_text_label,
100
+ column_type_input,
101
+ column_type_label,
102
+ index_input,
103
+ index_label,
104
+ nullable_input,
105
+ nullable_label,
106
+ ],
107
+ remove_column: [
108
+ column_input,
109
+ column_label,
110
+ ],
111
+ rename_column: [
112
+ column_input,
113
+ column_label,
114
+ new_column_name_input,
115
+ new_column_name_label,
116
+ ],
117
+ change_column_type: [
118
+ column_input,
119
+ column_label,
120
+ column_type_input,
121
+ column_type_label,
122
+ ],
123
+ belongs_to: [
124
+ belongs_to_input,
125
+ belongs_to_label,
126
+ ],
127
+ add_index_to_column: [
128
+ column_input,
129
+ column_label,
130
+ ],
131
+ remove_index_to_column: [
132
+ column_input,
133
+ column_label,
134
+ ],
69
135
  drop_table: [],
70
136
  }
71
137
 
@@ -100,7 +166,6 @@ MainApp = {
100
166
  }
101
167
  }
102
168
 
103
-
104
169
  MainApp.init();
105
170
 
106
171
  $(document).ready(function() {
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Masonry PACKAGED v4.1.1
3
+ * Cascading grid layout library
4
+ * http://masonry.desandro.com
5
+ * MIT License
6
+ * by David DeSandro
7
+ */
8
+
9
+ !function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,r,a){function h(t,e,n){var o,r="$()."+i+'("'+e+'")';return t.each(function(t,h){var u=a.data(h,i);if(!u)return void s(i+" not initialized. Cannot call methods, i.e. "+r);var d=u[e];if(!d||"_"==e.charAt(0))return void s(r+" is not a valid method");var l=d.apply(u,n);o=void 0===o?l:o}),void 0!==o?o:t}function u(t,e){t.each(function(t,n){var o=a.data(n,i);o?(o.option(e),o._init()):(o=new r(n,e),a.data(n,i,o))})}a=a||e||t.jQuery,a&&(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=o.call(arguments,1);return h(this,t,e)}return u(this,t),this},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=i)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,o=i[n];e=e||[];for(var r=this._onceEvents&&this._onceEvents[t];o;){var s=r&&r[o];s&&(this.off(t,o),delete r[o]),o.apply(this,e),n+=s?0:1,o=i[n]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t),i=-1==t.indexOf("%")&&!isNaN(e);return i&&e}function e(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;u>e;e++){var i=h[e];t[i]=0}return t}function n(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),e}function o(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var o=n(e);r.isBoxSizeOuter=s=200==t(o.width),i.removeChild(e)}}function r(e){if(o(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var r=n(e);if("none"==r.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==r.boxSizing,l=0;u>l;l++){var c=h[l],f=r[c],m=parseFloat(f);a[c]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,g=a.paddingTop+a.paddingBottom,y=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,E=a.borderTopWidth+a.borderBottomWidth,z=d&&s,b=t(r.width);b!==!1&&(a.width=b+(z?0:p+_));var x=t(r.height);return x!==!1&&(a.height=x+(z?0:g+E)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(g+E),a.outerWidth=a.width+y,a.outerHeight=a.height+v,a}}var s,a="undefined"==typeof console?e:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],u=h.length,d=!1;return r}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i<e.length;i++){var n=e[i],o=n+"MatchesSelector";if(t[o])return o}}();return function(e,i){return e[t](i)}}),function(t,e){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["desandro-matches-selector/matches-selector"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("desandro-matches-selector")):t.fizzyUIUtils=e(t,t.matchesSelector)}(window,function(t,e){var i={};i.extend=function(t,e){for(var i in e)t[i]=e[i];return t},i.modulo=function(t,e){return(t%e+e)%e},i.makeArray=function(t){var e=[];if(Array.isArray(t))e=t;else if(t&&"number"==typeof t.length)for(var i=0;i<t.length;i++)e.push(t[i]);else e.push(t);return e},i.removeFrom=function(t,e){var i=t.indexOf(e);-1!=i&&t.splice(i,1)},i.getParent=function(t,i){for(;t!=document.body;)if(t=t.parentNode,e(t,i))return t},i.getQueryElement=function(t){return"string"==typeof t?document.querySelector(t):t},i.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},i.filterFindElements=function(t,n){t=i.makeArray(t);var o=[];return t.forEach(function(t){if(t instanceof HTMLElement){if(!n)return void o.push(t);e(t,n)&&o.push(t);for(var i=t.querySelectorAll(n),r=0;r<i.length;r++)o.push(i[r])}}),o},i.debounceMethod=function(t,e,i){var n=t.prototype[e],o=e+"Timeout";t.prototype[e]=function(){var t=this[o];t&&clearTimeout(t);var e=arguments,r=this;this[o]=setTimeout(function(){n.apply(r,e),delete r[o]},i||100)}},i.docReady=function(t){var e=document.readyState;"complete"==e||"interactive"==e?t():document.addEventListener("DOMContentLoaded",t)},i.toDashed=function(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()};var n=t.console;return i.htmlInit=function(e,o){i.docReady(function(){var r=i.toDashed(o),s="data-"+r,a=document.querySelectorAll("["+s+"]"),h=document.querySelectorAll(".js-"+r),u=i.makeArray(a).concat(i.makeArray(h)),d=s+"-options",l=t.jQuery;u.forEach(function(t){var i,r=t.getAttribute(s)||t.getAttribute(d);try{i=r&&JSON.parse(r)}catch(a){return void(n&&n.error("Error parsing "+s+" on "+t.className+": "+a))}var h=new e(t,i);l&&l.data(t,o,h)})})},i}),function(t,e){"function"==typeof define&&define.amd?define("outlayer/item",["ev-emitter/ev-emitter","get-size/get-size"],e):"object"==typeof module&&module.exports?module.exports=e(require("ev-emitter"),require("get-size")):(t.Outlayer={},t.Outlayer.Item=e(t.EvEmitter,t.getSize))}(window,function(t,e){"use strict";function i(t){for(var e in t)return!1;return e=null,!0}function n(t,e){t&&(this.element=t,this.layout=e,this.position={x:0,y:0},this._create())}function o(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}var r=document.documentElement.style,s="string"==typeof r.transition?"transition":"WebkitTransition",a="string"==typeof r.transform?"transform":"WebkitTransform",h={WebkitTransition:"webkitTransitionEnd",transition:"transitionend"}[s],u={transform:a,transition:s,transitionDuration:s+"Duration",transitionProperty:s+"Property",transitionDelay:s+"Delay"},d=n.prototype=Object.create(t.prototype);d.constructor=n,d._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},d.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},d.getSize=function(){this.size=e(this.element)},d.css=function(t){var e=this.element.style;for(var i in t){var n=u[i]||i;e[n]=t[i]}},d.getPosition=function(){var t=getComputedStyle(this.element),e=this.layout._getOption("originLeft"),i=this.layout._getOption("originTop"),n=t[e?"left":"right"],o=t[i?"top":"bottom"],r=this.layout.size,s=-1!=n.indexOf("%")?parseFloat(n)/100*r.width:parseInt(n,10),a=-1!=o.indexOf("%")?parseFloat(o)/100*r.height:parseInt(o,10);s=isNaN(s)?0:s,a=isNaN(a)?0:a,s-=e?r.paddingLeft:r.paddingRight,a-=i?r.paddingTop:r.paddingBottom,this.position.x=s,this.position.y=a},d.layoutPosition=function(){var t=this.layout.size,e={},i=this.layout._getOption("originLeft"),n=this.layout._getOption("originTop"),o=i?"paddingLeft":"paddingRight",r=i?"left":"right",s=i?"right":"left",a=this.position.x+t[o];e[r]=this.getXValue(a),e[s]="";var h=n?"paddingTop":"paddingBottom",u=n?"top":"bottom",d=n?"bottom":"top",l=this.position.y+t[h];e[u]=this.getYValue(l),e[d]="",this.css(e),this.emitEvent("layout",[this])},d.getXValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&!e?t/this.layout.size.width*100+"%":t+"px"},d.getYValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&e?t/this.layout.size.height*100+"%":t+"px"},d._transitionTo=function(t,e){this.getPosition();var i=this.position.x,n=this.position.y,o=parseInt(t,10),r=parseInt(e,10),s=o===this.position.x&&r===this.position.y;if(this.setPosition(t,e),s&&!this.isTransitioning)return void this.layoutPosition();var a=t-i,h=e-n,u={};u.transform=this.getTranslate(a,h),this.transition({to:u,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},d.getTranslate=function(t,e){var i=this.layout._getOption("originLeft"),n=this.layout._getOption("originTop");return t=i?t:-t,e=n?e:-e,"translate3d("+t+"px, "+e+"px, 0)"},d.goTo=function(t,e){this.setPosition(t,e),this.layoutPosition()},d.moveTo=d._transitionTo,d.setPosition=function(t,e){this.position.x=parseInt(t,10),this.position.y=parseInt(e,10)},d._nonTransition=function(t){this.css(t.to),t.isCleaning&&this._removeStyles(t.to);for(var e in t.onTransitionEnd)t.onTransitionEnd[e].call(this)},d.transition=function(t){if(!parseFloat(this.layout.options.transitionDuration))return void this._nonTransition(t);var e=this._transn;for(var i in t.onTransitionEnd)e.onEnd[i]=t.onTransitionEnd[i];for(i in t.to)e.ingProperties[i]=!0,t.isCleaning&&(e.clean[i]=!0);if(t.from){this.css(t.from);var n=this.element.offsetHeight;n=null}this.enableTransition(t.to),this.css(t.to),this.isTransitioning=!0};var l="opacity,"+o(a);d.enableTransition=function(){if(!this.isTransitioning){var t=this.layout.options.transitionDuration;t="number"==typeof t?t+"ms":t,this.css({transitionProperty:l,transitionDuration:t,transitionDelay:this.staggerDelay||0}),this.element.addEventListener(h,this,!1)}},d.onwebkitTransitionEnd=function(t){this.ontransitionend(t)},d.onotransitionend=function(t){this.ontransitionend(t)};var c={"-webkit-transform":"transform"};d.ontransitionend=function(t){if(t.target===this.element){var e=this._transn,n=c[t.propertyName]||t.propertyName;if(delete e.ingProperties[n],i(e.ingProperties)&&this.disableTransition(),n in e.clean&&(this.element.style[t.propertyName]="",delete e.clean[n]),n in e.onEnd){var o=e.onEnd[n];o.call(this),delete e.onEnd[n]}this.emitEvent("transitionEnd",[this])}},d.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(h,this,!1),this.isTransitioning=!1},d._removeStyles=function(t){var e={};for(var i in t)e[i]="";this.css(e)};var f={transitionProperty:"",transitionDuration:"",transitionDelay:""};return d.removeTransitionStyles=function(){this.css(f)},d.stagger=function(t){t=isNaN(t)?0:t,this.staggerDelay=t+"ms"},d.removeElem=function(){this.element.parentNode.removeChild(this.element),this.css({display:""}),this.emitEvent("remove",[this])},d.remove=function(){return s&&parseFloat(this.layout.options.transitionDuration)?(this.once("transitionEnd",function(){this.removeElem()}),void this.hide()):void this.removeElem()},d.reveal=function(){delete this.isHidden,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("visibleStyle");e[i]=this.onRevealTransitionEnd,this.transition({from:t.hiddenStyle,to:t.visibleStyle,isCleaning:!0,onTransitionEnd:e})},d.onRevealTransitionEnd=function(){this.isHidden||this.emitEvent("reveal")},d.getHideRevealTransitionEndProperty=function(t){var e=this.layout.options[t];if(e.opacity)return"opacity";for(var i in e)return i},d.hide=function(){this.isHidden=!0,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("hiddenStyle");e[i]=this.onHideTransitionEnd,this.transition({from:t.visibleStyle,to:t.hiddenStyle,isCleaning:!0,onTransitionEnd:e})},d.onHideTransitionEnd=function(){this.isHidden&&(this.css({display:"none"}),this.emitEvent("hide"))},d.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},n}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("outlayer/outlayer",["ev-emitter/ev-emitter","get-size/get-size","fizzy-ui-utils/utils","./item"],function(i,n,o,r){return e(t,i,n,o,r)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter"),require("get-size"),require("fizzy-ui-utils"),require("./item")):t.Outlayer=e(t,t.EvEmitter,t.getSize,t.fizzyUIUtils,t.Outlayer.Item)}(window,function(t,e,i,n,o){"use strict";function r(t,e){var i=n.getQueryElement(t);if(!i)return void(h&&h.error("Bad element for "+this.constructor.namespace+": "+(i||t)));this.element=i,u&&(this.$element=u(this.element)),this.options=n.extend({},this.constructor.defaults),this.option(e);var o=++l;this.element.outlayerGUID=o,c[o]=this,this._create();var r=this._getOption("initLayout");r&&this.layout()}function s(t){function e(){t.apply(this,arguments)}return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e}function a(t){if("number"==typeof t)return t;var e=t.match(/(^\d*\.?\d*)(\w*)/),i=e&&e[1],n=e&&e[2];if(!i.length)return 0;i=parseFloat(i);var o=m[n]||1;return i*o}var h=t.console,u=t.jQuery,d=function(){},l=0,c={};r.namespace="outlayer",r.Item=o,r.defaults={containerStyle:{position:"relative"},initLayout:!0,originLeft:!0,originTop:!0,resize:!0,resizeContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}};var f=r.prototype;n.extend(f,e.prototype),f.option=function(t){n.extend(this.options,t)},f._getOption=function(t){var e=this.constructor.compatOptions[t];return e&&void 0!==this.options[e]?this.options[e]:this.options[t]},r.compatOptions={initLayout:"isInitLayout",horizontal:"isHorizontal",layoutInstant:"isLayoutInstant",originLeft:"isOriginLeft",originTop:"isOriginTop",resize:"isResizeBound",resizeContainer:"isResizingContainer"},f._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),n.extend(this.element.style,this.options.containerStyle);var t=this._getOption("resize");t&&this.bindResize()},f.reloadItems=function(){this.items=this._itemize(this.element.children)},f._itemize=function(t){for(var e=this._filterFindItemElements(t),i=this.constructor.Item,n=[],o=0;o<e.length;o++){var r=e[o],s=new i(r,this);n.push(s)}return n},f._filterFindItemElements=function(t){return n.filterFindElements(t,this.options.itemSelector)},f.getItemElements=function(){return this.items.map(function(t){return t.element})},f.layout=function(){this._resetLayout(),this._manageStamps();var t=this._getOption("layoutInstant"),e=void 0!==t?t:!this._isLayoutInited;this.layoutItems(this.items,e),this._isLayoutInited=!0},f._init=f.layout,f._resetLayout=function(){this.getSize()},f.getSize=function(){this.size=i(this.element)},f._getMeasurement=function(t,e){var n,o=this.options[t];o?("string"==typeof o?n=this.element.querySelector(o):o instanceof HTMLElement&&(n=o),this[t]=n?i(n)[e]:o):this[t]=0},f.layoutItems=function(t,e){t=this._getItemsForLayout(t),this._layoutItems(t,e),this._postLayout()},f._getItemsForLayout=function(t){return t.filter(function(t){return!t.isIgnored})},f._layoutItems=function(t,e){if(this._emitCompleteOnItems("layout",t),t&&t.length){var i=[];t.forEach(function(t){var n=this._getItemLayoutPosition(t);n.item=t,n.isInstant=e||t.isLayoutInstant,i.push(n)},this),this._processLayoutQueue(i)}},f._getItemLayoutPosition=function(){return{x:0,y:0}},f._processLayoutQueue=function(t){this.updateStagger(),t.forEach(function(t,e){this._positionItem(t.item,t.x,t.y,t.isInstant,e)},this)},f.updateStagger=function(){var t=this.options.stagger;return null===t||void 0===t?void(this.stagger=0):(this.stagger=a(t),this.stagger)},f._positionItem=function(t,e,i,n,o){n?t.goTo(e,i):(t.stagger(o*this.stagger),t.moveTo(e,i))},f._postLayout=function(){this.resizeContainer()},f.resizeContainer=function(){var t=this._getOption("resizeContainer");if(t){var e=this._getContainerSize();e&&(this._setContainerMeasure(e.width,!0),this._setContainerMeasure(e.height,!1))}},f._getContainerSize=d,f._setContainerMeasure=function(t,e){if(void 0!==t){var i=this.size;i.isBorderBox&&(t+=e?i.paddingLeft+i.paddingRight+i.borderLeftWidth+i.borderRightWidth:i.paddingBottom+i.paddingTop+i.borderTopWidth+i.borderBottomWidth),t=Math.max(t,0),this.element.style[e?"width":"height"]=t+"px"}},f._emitCompleteOnItems=function(t,e){function i(){o.dispatchEvent(t+"Complete",null,[e])}function n(){s++,s==r&&i()}var o=this,r=e.length;if(!e||!r)return void i();var s=0;e.forEach(function(e){e.once(t,n)})},f.dispatchEvent=function(t,e,i){var n=e?[e].concat(i):i;if(this.emitEvent(t,n),u)if(this.$element=this.$element||u(this.element),e){var o=u.Event(e);o.type=t,this.$element.trigger(o,i)}else this.$element.trigger(t,i)},f.ignore=function(t){var e=this.getItem(t);e&&(e.isIgnored=!0)},f.unignore=function(t){var e=this.getItem(t);e&&delete e.isIgnored},f.stamp=function(t){t=this._find(t),t&&(this.stamps=this.stamps.concat(t),t.forEach(this.ignore,this))},f.unstamp=function(t){t=this._find(t),t&&t.forEach(function(t){n.removeFrom(this.stamps,t),this.unignore(t)},this)},f._find=function(t){return t?("string"==typeof t&&(t=this.element.querySelectorAll(t)),t=n.makeArray(t)):void 0},f._manageStamps=function(){this.stamps&&this.stamps.length&&(this._getBoundingRect(),this.stamps.forEach(this._manageStamp,this))},f._getBoundingRect=function(){var t=this.element.getBoundingClientRect(),e=this.size;this._boundingRect={left:t.left+e.paddingLeft+e.borderLeftWidth,top:t.top+e.paddingTop+e.borderTopWidth,right:t.right-(e.paddingRight+e.borderRightWidth),bottom:t.bottom-(e.paddingBottom+e.borderBottomWidth)}},f._manageStamp=d,f._getElementOffset=function(t){var e=t.getBoundingClientRect(),n=this._boundingRect,o=i(t),r={left:e.left-n.left-o.marginLeft,top:e.top-n.top-o.marginTop,right:n.right-e.right-o.marginRight,bottom:n.bottom-e.bottom-o.marginBottom};return r},f.handleEvent=n.handleEvent,f.bindResize=function(){t.addEventListener("resize",this),this.isResizeBound=!0},f.unbindResize=function(){t.removeEventListener("resize",this),this.isResizeBound=!1},f.onresize=function(){this.resize()},n.debounceMethod(r,"onresize",100),f.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},f.needsResizeLayout=function(){var t=i(this.element),e=this.size&&t;return e&&t.innerWidth!==this.size.innerWidth},f.addItems=function(t){var e=this._itemize(t);return e.length&&(this.items=this.items.concat(e)),e},f.appended=function(t){var e=this.addItems(t);e.length&&(this.layoutItems(e,!0),this.reveal(e))},f.prepended=function(t){var e=this._itemize(t);if(e.length){var i=this.items.slice(0);this.items=e.concat(i),this._resetLayout(),this._manageStamps(),this.layoutItems(e,!0),this.reveal(e),this.layoutItems(i)}},f.reveal=function(t){if(this._emitCompleteOnItems("reveal",t),t&&t.length){var e=this.updateStagger();t.forEach(function(t,i){t.stagger(i*e),t.reveal()})}},f.hide=function(t){if(this._emitCompleteOnItems("hide",t),t&&t.length){var e=this.updateStagger();t.forEach(function(t,i){t.stagger(i*e),t.hide()})}},f.revealItemElements=function(t){var e=this.getItems(t);this.reveal(e)},f.hideItemElements=function(t){var e=this.getItems(t);this.hide(e)},f.getItem=function(t){for(var e=0;e<this.items.length;e++){var i=this.items[e];if(i.element==t)return i}},f.getItems=function(t){t=n.makeArray(t);var e=[];return t.forEach(function(t){var i=this.getItem(t);i&&e.push(i)},this),e},f.remove=function(t){var e=this.getItems(t);this._emitCompleteOnItems("remove",e),e&&e.length&&e.forEach(function(t){t.remove(),n.removeFrom(this.items,t)},this)},f.destroy=function(){var t=this.element.style;t.height="",t.position="",t.width="",this.items.forEach(function(t){t.destroy()}),this.unbindResize();var e=this.element.outlayerGUID;delete c[e],delete this.element.outlayerGUID,u&&u.removeData(this.element,this.constructor.namespace)},r.data=function(t){t=n.getQueryElement(t);var e=t&&t.outlayerGUID;return e&&c[e]},r.create=function(t,e){var i=s(r);return i.defaults=n.extend({},r.defaults),n.extend(i.defaults,e),i.compatOptions=n.extend({},r.compatOptions),i.namespace=t,i.data=r.data,i.Item=s(o),n.htmlInit(i,t),u&&u.bridget&&u.bridget(t,i),i};var m={ms:1,s:1e3};return r.Item=o,r}),function(t,e){"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size"],e):"object"==typeof module&&module.exports?module.exports=e(require("outlayer"),require("get-size")):t.Masonry=e(t.Outlayer,t.getSize)}(window,function(t,e){var i=t.create("masonry");return i.compatOptions.fitWidth="isFitWidth",i.prototype._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns(),this.colYs=[];for(var t=0;t<this.cols;t++)this.colYs.push(0);this.maxY=0},i.prototype.measureColumns=function(){if(this.getContainerWidth(),!this.columnWidth){var t=this.items[0],i=t&&t.element;this.columnWidth=i&&e(i).outerWidth||this.containerWidth}var n=this.columnWidth+=this.gutter,o=this.containerWidth+this.gutter,r=o/n,s=n-o%n,a=s&&1>s?"round":"floor";r=Math[a](r),this.cols=Math.max(r,1)},i.prototype.getContainerWidth=function(){var t=this._getOption("fitWidth"),i=t?this.element.parentNode:this.element,n=e(i);this.containerWidth=n&&n.innerWidth},i.prototype._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=e&&1>e?"round":"ceil",n=Math[i](t.size.outerWidth/this.columnWidth);n=Math.min(n,this.cols);for(var o=this._getColGroup(n),r=Math.min.apply(Math,o),s=o.indexOf(r),a={x:this.columnWidth*s,y:r},h=r+t.size.outerHeight,u=this.cols+1-o.length,d=0;u>d;d++)this.colYs[s+d]=h;return a},i.prototype._getColGroup=function(t){if(2>t)return this.colYs;for(var e=[],i=this.cols+1-t,n=0;i>n;n++){var o=this.colYs.slice(n,n+t);e[n]=Math.max.apply(Math,o)}return e},i.prototype._manageStamp=function(t){var i=e(t),n=this._getElementOffset(t),o=this._getOption("originLeft"),r=o?n.left:n.right,s=r+i.outerWidth,a=Math.floor(r/this.columnWidth);a=Math.max(0,a);var h=Math.floor(s/this.columnWidth);h-=s%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var u=this._getOption("originTop"),d=(u?n.top:n.bottom)+i.outerHeight,l=a;h>=l;l++)this.colYs[l]=Math.max(d,this.colYs[l])},i.prototype._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},i.prototype._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},i.prototype.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},i});