boilerman 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c4862a5fd466faab09956c10d0f54459b586a16
4
- data.tar.gz: 2eb9a9ff7645c7d42b5ceefa30c2165c77a96e2a
3
+ metadata.gz: 86a5e6ff2ca813d33e0c7f536e06d6ea49a9a1cc
4
+ data.tar.gz: 5da51743c0982f1451408c86deb2e872a25fef47
5
5
  SHA512:
6
- metadata.gz: 1df057b5388a7cea3d75e5f940f0d9f734acc5e89c0e47af51d4f15675c8cf2e9ee1dd056da3e7c55bfa51129c5f1c1d2831be2351e5536853ab8484cb357a01
7
- data.tar.gz: 20cce6b12de20dc853c9b50871332003a88d0c5c8cef47baaee78b17a2b6e8e192af97cba4610eccc1877397f809a62a5f4c7db70c7dd50a86fbea8f4bdae877
6
+ metadata.gz: 768b92dc770378e6ff4be390fdc8a806052bac7af70da7cc8e46da5c52abaf6f121e1bab12e8b2d1f7c1b167b8966adab56eff4d7e4b76d4a58da3ce520fa39c
7
+ data.tar.gz: bb7f6e0f15388c922caa0b0d648acf683e6dd8acd529e6298826ab9db84975d5532ea169f106465ea79e964aeded18473011d7a3e87db5dc6e45d86fd36bc28e
@@ -1,23 +1,115 @@
1
- function clearLocalFilters() {
2
- var x;
3
- if (confirm("Are you sure you want to clear your saved filters?") == true) {
4
- alert(gon.controllers);
5
- console.log("Clearing local storage");
6
- }
1
+ $( document ).ready(function() {
2
+ // Initialize global variables
3
+ window.controller_filters = [];
4
+
5
+ // When the enter key is pressed on the filter input boxes, trigger the
6
+ // onclick event for that text box
7
+ $("#controller_filter_input").keyup(function(event){
8
+ if(event.keyCode == 13){
9
+ $("#controller_filter_input_btn").click();
10
+ }
11
+ });
12
+
13
+ $("#action_with_filter_input").keyup(function(event){
14
+ if(event.keyCode == 13){
15
+ $("#action_with_filter_input_btn").click();
16
+ }
17
+ });
18
+
19
+ $("#action_without_filter_input").keyup(function(event){
20
+ if(event.keyCode == 13){
21
+ $("#action_without_filter_input_btn").click();
22
+ }
23
+ });
24
+ });
25
+
26
+ function removeController(list_item) {
27
+ var index = window.controller_filters.indexOf(list_item.text);
28
+ if (index > -1) {
29
+ window.controller_filters.splice(index, 1);
30
+ }
31
+
32
+ list_item.remove();
33
+
34
+ update_page();
35
+ }
36
+
37
+ function update_page() {
38
+ // Clear the value in the input field
39
+ var rows = $("#callbackBreakdownTbl").find("tr.callback_lineitem").hide();
40
+
41
+ if (window.controller_filters.length == 0) {
42
+ rows.show();
43
+ $("#include-controllers").find("li.list-group-item").show();
44
+ }
45
+ else {
46
+ var data = window.controller_filters;
47
+ $.each(data, function (i, v) {
48
+ rows.filter(":contains('" + v + "')").show();
49
+ });
50
+ $("#include-controllers").find("li.list-group-item").hide();
51
+ }
52
+ }
53
+
54
+ function filterController() {
55
+ var filter_input = $("#controller_filter_input")[0];
56
+
57
+ if (filter_input.value.length) {
58
+ // Add the filter to the global array of controller filters
59
+ window.controller_filters.push(filter_input.value);
60
+
61
+ // Add this filter to the controller filter list group
62
+ update_controller_filter_list(filter_input.value);
63
+
64
+ } else rows.show();
65
+
66
+ $("#controller_filter_input").val('');
67
+ update_page();
7
68
  }
8
69
 
70
+ function update_controller_filter_list(filter) {
71
+
72
+ // Add the filter to the include-controllers list group
73
+ build_list_group_item(filter);
74
+ }
75
+
76
+ function build_list_group_item(filter) {
77
+ var list_item = $('<a>',{
78
+ text: filter,
79
+ href: '#',
80
+ onclick: "removeController(this)",
81
+ class: "list-group-item"
82
+ })
83
+
84
+ $('<span>', {
85
+ class: "glyphicon glyphicon-remove pull-right list-group-span",
86
+ "aria-hidden": true
87
+ }).appendTo(list_item);
88
+
89
+ list_item.appendTo('#include-controllers');
90
+ }
91
+
92
+ // TODO
93
+ function action_with_filter() {
94
+ console.log("TODO: Implement action_with_filter()");
95
+ }
96
+
97
+ function action_without_filter() {
98
+ console.log("TODO: Implement action_without_filter()");
99
+ }
9
100
  function removeWithoutActionItem() {
10
101
  //TODO: Implement this
11
102
  console.log("TODO: IMPLEMENT removeWithoutActionItem()");
12
103
  }
13
-
14
-
15
104
  function removeWithActionItem() {
16
105
  //TODO: Implement this
17
106
  console.log("TODO: IMPLEMENT removeWithActionItem()");
18
107
  }
19
-
20
- function removeController() {
21
- //TODO: Implement this
22
- console.log("TODO: IMPLEMENT removeController()");
108
+ function clearLocalFilters() {
109
+ // TODO
110
+ var x;
111
+ if (confirm("Are you sure you want to clear your saved filters?") == true) {
112
+ alert(gon.controllers);
113
+ console.log("Clearing local storage");
114
+ }
23
115
  }
@@ -2,10 +2,12 @@ require_dependency "boilerman/application_controller"
2
2
 
3
3
  module Boilerman
4
4
  class ControllersController < ApplicationController
5
+ before_filter :eager_load
6
+
5
7
  def index
6
- @action_with_filters = [:require_admin, :require_staff]
7
- @action_without_filters = [:verify_authenticity_token]
8
- @controller_filters = ["ApplicationController"]
8
+ @action_with_filters = []
9
+ @action_without_filters = []
10
+ @controller_filters = []
9
11
 
10
12
  @controllers = filtered_controllers
11
13
  @controllers_and_callbacks = @controllers.map do |controller|
@@ -17,6 +19,22 @@ module Boilerman
17
19
  end
18
20
 
19
21
  private
22
+ def eager_load
23
+ # FIXME This is required when developing boilerman and cache_classes is
24
+ # set to false. Need to think of a proper workaround for this. Possibly
25
+ # checking for a BOILERMAN_DEV enviornment variable and maybe changing
26
+ # this line to:
27
+ #
28
+ # Rails.application.eager_load! if ENV["BOILERMAN_DEV"]
29
+ #
30
+ # But then you have to specifify that everytime you run the app server
31
+ # for dev and if you forget it, debugging this is going not be fun.
32
+ #
33
+ # Alternatively, just eager_load on every request. It'll take a bit
34
+ # longer but we can be sure the classes will be there and most of the
35
+ # Boilerman usge is client side anyways.
36
+ Rails.application.eager_load!
37
+ end
20
38
 
21
39
  def filtered_controllers
22
40
  # Process only controllers with callbacks and do not include
@@ -4,12 +4,12 @@
4
4
  <div class="col-lg-6">
5
5
  <div class="input-group">
6
6
  <span class="input-group-btn">
7
- <button class="btn btn-success" type="button">
7
+ <button id="action_with_filter_input_btn" class="btn btn-success" type="button" onclick="action_with_filter()">
8
8
  <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
9
9
  With
10
10
  </button>
11
11
  </span>
12
- <input type="text" class="form-control" placeholder="(e.g. require_admin)">
12
+ <input id="action_with_filter_input" type="text" class="form-control" placeholder="(e.g. require_admin)" >
13
13
  </div><!-- /input-group -->
14
14
 
15
15
  <ul class="list-group top-buffer" id="with-actions">
@@ -29,12 +29,12 @@
29
29
  <div class="col-lg-6">
30
30
  <div class="input-group">
31
31
  <span class="input-group-btn">
32
- <button class="btn btn-danger" type="button">
32
+ <button id="action_without_filter_input_btn" class="btn btn-danger" type="button" onclick="action_without_filter()">
33
33
  <span class="glyphicon glyphicon-minus" aria-hidden="true"></span>
34
34
  Without
35
35
  </button>
36
36
  </span>
37
- <input type="text" class="form-control" placeholder="(e.g. verify_authenticity_token)">
37
+ <input id="action_without_filter_input" type="text" class="form-control" placeholder="(e.g. verify_authenticity_token)">
38
38
  </div><!-- /input-group -->
39
39
 
40
40
  <ul class="list-group top-buffer" id="without-actions">
@@ -0,0 +1,21 @@
1
+ <div class="panel panel-default">
2
+ <div class="panel-heading" role="tab" id="headingThree">
3
+ <h4 class="panel-title">
4
+ <a class="collapsed" role="button" data-toggle="collapse" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
5
+ Application Statistics
6
+ </a>
7
+ </h4>
8
+ </div>
9
+ <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
10
+ <div class="panel-body">
11
+ <div>
12
+ <p>Number of Controllers: <%= @controllers.count %></p>
13
+
14
+ <h3>Namespace Breakdown</h3>
15
+ <p>Devise: 13 controllers</p>
16
+ <p>Admin: 17 controllers</p>
17
+
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </div>
@@ -0,0 +1,35 @@
1
+ <div class="panel panel-default">
2
+ <div class="panel-heading" role="tab" id="headingOne">
3
+ <h4 class="panel-title">
4
+ <a role="button" data-toggle="collapse" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
5
+ Callback Breakdown
6
+ </a>
7
+ </h4>
8
+ </div>
9
+ <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
10
+ <div class="panel-body">
11
+ <table id="callbackBreakdownTbl" class="table">
12
+ <thead>
13
+ <th>Controller</th>
14
+ <th>Filters</th>
15
+ </thead>
16
+ <tbody>
17
+ <% @controllers_and_callbacks.each do |controller, callbacks| %>
18
+ <tr class="callback_lineitem">
19
+ <td><%= controller %></td>
20
+ <td>
21
+ <table>
22
+ <% callbacks.each do |callback| %>
23
+ <tr>
24
+ <td><%= callback %></td>
25
+ </tr>
26
+ <% end %>
27
+ </table>
28
+ </td>
29
+ </tr>
30
+ <% end %>
31
+ </tbody>
32
+ </table>
33
+ </div>
34
+ </div>
35
+ </div>
@@ -4,12 +4,12 @@
4
4
  <div class="col-lg-6">
5
5
  <div class="input-group">
6
6
  <span class="input-group-btn">
7
- <button class="btn btn-success" type="button">
7
+ <button id="controller_filter_input_btn" onclick="filterController()" class="btn btn-success" type="button">
8
8
  <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
9
9
  Include
10
10
  </button>
11
11
  </span>
12
- <input type="text" class="form-control" placeholder="Filters by controller name...">
12
+ <input id="controller_filter_input" type="text" class="form-control" placeholder="Filters by controller name...">
13
13
  </div><!-- /input-group -->
14
14
  </div><!-- /.col-lg-6 -->
15
15
 
@@ -19,7 +19,7 @@
19
19
  <li class="list-group-item">No controller filters currently set</li>
20
20
  <% else %>
21
21
  <% @controller_filters.each do |controller_filter| %>
22
- <a href="#" onclick="removeController()" class="list-group-item">
22
+ <a href="#" onclick="removeController(this)" class="list-group-item">
23
23
  <%= controller_filter %>
24
24
  <span class="glyphicon glyphicon-remove pull-right list-group-span" aria-hidden="true"></span>
25
25
  </a>
@@ -0,0 +1,22 @@
1
+ <div class="panel panel-default">
2
+ <div class="panel-heading" role="tab" id="headingTwo">
3
+ <h4 class="panel-title">
4
+ <a class="collapsed" role="button" data-toggle="collapse" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
5
+ Controller List
6
+ </a>
7
+ </h4>
8
+ </div>
9
+ <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
10
+ <div class="panel-body">
11
+ <table class="table">
12
+ <% @controllers.each_slice(5) do |controller_slice| %>
13
+ <tr>
14
+ <% controller_slice.each do |controller| %>
15
+ <td><%= controller %></td>
16
+ <% end %>
17
+ </tr>
18
+ <% end %>
19
+ </table>
20
+ </div>
21
+ </div>
22
+ </div>
@@ -16,48 +16,9 @@
16
16
 
17
17
  <div class="row">
18
18
  <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
19
- <div class="panel panel-default">
20
- <div class="panel-heading" role="tab" id="headingOne">
21
- <h4 class="panel-title">
22
- <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
23
- Application Statistics
24
- </a>
25
- </h4>
26
- </div>
27
- <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
28
- <div class="panel-body">
29
- <%= render "application_statistics" %>
30
- </div>
31
- </div>
32
- </div>
33
- <div class="panel panel-default">
34
- <div class="panel-heading" role="tab" id="headingTwo">
35
- <h4 class="panel-title">
36
- <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
37
- Controller List
38
- </a>
39
- </h4>
40
- </div>
41
- <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
42
- <div class="panel-body">
43
- <%= render "controller_list" %>
44
- </div>
45
- </div>
46
- </div>
47
- <div class="panel panel-default">
48
- <div class="panel-heading" role="tab" id="headingThree">
49
- <h4 class="panel-title">
50
- <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
51
- Callback Breakdown
52
- </a>
53
- </h4>
54
- </div>
55
- <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
56
- <div class="panel-body">
57
- <%= render "callback_breakdown" %>
58
- </div>
59
- </div>
60
- </div>
19
+ <%= render "controller_list_panel" %>
20
+ <%= render "callback_breakdown_panel" %>
21
+ <%= render "application_statistics_panel" %>
61
22
  </div>
62
23
  </div>
63
24
 
@@ -23,7 +23,7 @@ module Boilerman
23
23
  # Note, this will not propogate code changes and will require server
24
24
  # restarts if you change code.
25
25
  app.config.eager_load = true
26
- app.config.cache_classes = true
26
+ #app.config.cache_classes = true
27
27
  end
28
28
  end
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module Boilerman
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boilerman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomek Rabczak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-18 00:00:00.000000000 Z
11
+ date: 2015-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -100,10 +100,10 @@ files:
100
100
  - app/helpers/boilerman/application_helper.rb
101
101
  - app/helpers/boilerman/controllers_helper.rb
102
102
  - app/views/boilerman/controllers/_action_filter.html.erb
103
- - app/views/boilerman/controllers/_application_statistics.html.erb
104
- - app/views/boilerman/controllers/_callback_breakdown.html.erb
103
+ - app/views/boilerman/controllers/_application_statistics_panel.html.erb
104
+ - app/views/boilerman/controllers/_callback_breakdown_panel.html.erb
105
105
  - app/views/boilerman/controllers/_controller_filter.html.erb
106
- - app/views/boilerman/controllers/_controller_list.html.erb
106
+ - app/views/boilerman/controllers/_controller_list_panel.html.erb
107
107
  - app/views/boilerman/controllers/index.html.erb
108
108
  - app/views/layouts/boilerman/application.html.erb
109
109
  - config/locales/en.bootstrap.yml
@@ -1,8 +0,0 @@
1
- <div>
2
- <p>Number of Controllers: <%= @controllers.count %></p>
3
-
4
- <h3>Namespace Breakdown</h3>
5
- <p>Devise: 13 controllers</p>
6
- <p>Admin: 17 controllers</p>
7
-
8
- </div>
@@ -1,22 +0,0 @@
1
- <table class="table">
2
- <thead>
3
- <th>Controller</th>
4
- <th>Filters</th>
5
- </thead>
6
- <tbody>
7
- <% @controllers_and_callbacks.each do |controller, callbacks| %>
8
- <tr>
9
- <td><%= controller %></td>
10
- <td>
11
- <table>
12
- <% callbacks.each do |callback| %>
13
- <tr>
14
- <td><%= callback %></td>
15
- </tr>
16
- <% end %>
17
- </table>
18
- </td>
19
- </tr>
20
- <% end %>
21
- </tbody>
22
- </table>
@@ -1,9 +0,0 @@
1
- <table class="table">
2
- <% @controllers.each_slice(5) do |controller_slice| %>
3
- <tr>
4
- <% controller_slice.each do |controller| %>
5
- <td><%= controller %></td>
6
- <% end %>
7
- </tr>
8
- <% end %>
9
- </table>