cuke_sniffer 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,17 +1,23 @@
1
- <div class="title" onclick="toggleById('improvement_list_data', this)">
1
+ <div class="title" onclick="toggleById('improvement_list_data', this) ;updateDivScroll('improvement_list_data', 'improvements_table');">
2
2
  Improvement List +
3
3
  </div>
4
- <div class="shrink_section" id="improvement_list_data">
4
+ <div class="new_sub_section" id="improvement_list_data">
5
5
  <% improvement_list = cuke_sniffer.summary[:improvement_list] %>
6
6
  <% if improvement_list.empty? %>
7
7
  <div class="empty_set_message">No Improvements to make!</div>
8
8
  <% end %>
9
- <table style="width: 100%">
9
+ <table id="improvements_table" style="width: 100%" border="0" cellspacing="0">
10
+ <% index = 0 %>
10
11
  <% improvement_list.each do |improvement, count| %>
11
- <tr>
12
- <td class="red_number"><%= count %></td>
13
- <td class="notes"><%= improvement %></td>
12
+ <% if index.odd? %>
13
+ <tr class="blue_row">
14
+ <% else %>
15
+ <tr>
16
+ <% end %>
17
+ <td class="red_number" style="width:1%;"><%= count %></td>
18
+ <td class="notes" style="padding-left: 2px;"><%= improvement %></td>
14
19
  </tr>
20
+ <% index += 1 %>
15
21
  <% end %>
16
22
  </table>
17
23
  </div>
@@ -0,0 +1,65 @@
1
+ <script type="text/javascript">
2
+
3
+ function collapseAll(css_class) {
4
+ updateAll(css_class, "none");
5
+ }
6
+
7
+ function expandAll(css_class) {
8
+ updateAll(css_class, "inline-block");
9
+ }
10
+
11
+ function expandAllShiftingRows(css_class) {
12
+ var elements = document.getElementsByClassName(css_class)
13
+ for (var i = 0; i < elements.length; i++) {
14
+ existing_style = elements.item(i).getAttribute('style');
15
+ elements.item(i).setAttribute('style', existing_style.replace(/display:\s*none/, "display: block-inline"));
16
+ }
17
+ }
18
+
19
+ function updateAll(css_class, display_type){
20
+ var elements = document.getElementsByClassName(css_class)
21
+ for (var i = 0; i < elements.length; i++) {
22
+ elements.item(i).style.display = display_type;
23
+ }
24
+ }
25
+
26
+ function toggleById(item, link) {
27
+ updateDisplayStatus(document.getElementById(item));
28
+ toggleText(link)
29
+ }
30
+ function updateDisplayStatus(object) {
31
+ if (object.tagName == "TR") {
32
+ updateDisplayStatusForTR(object);
33
+ } else {
34
+ object.style.display = (object.style.display == "block") ? 'none' : "block";
35
+ }
36
+ }
37
+
38
+ function updateDivScroll(divId, tableId) {
39
+ div = document.getElementById(divId);
40
+ table = document.getElementById(tableId);
41
+ if (table.offsetHeight >= 500) {
42
+ div.style.height = "75%";
43
+ div.style.overflow = "auto";
44
+ } else {
45
+ div.style.height = "";
46
+ div.style.overflow = "none";
47
+ }
48
+
49
+ }
50
+
51
+ function updateDisplayStatusForTR(object) {
52
+ existing_style = object.getAttribute('style');
53
+ if (object.style.display == "none") {
54
+ object.setAttribute('style', existing_style.replace(/display:\s*none/, "display: block-inline"))
55
+ } else {
56
+ object.setAttribute('style', existing_style.replace("display: block-inline", "display: none"))
57
+ }
58
+ }
59
+ function toggleText(link) {
60
+ var char_result = link.innerHTML.indexOf("+") > -1 ? "-" : "+";
61
+ link.innerHTML = link.innerHTML.replace(/(\+|\-)/, char_result)
62
+ }
63
+
64
+
65
+ </script>
@@ -1,125 +1,16 @@
1
- <link rel="stylesheet" type="text/css" >
2
-
3
- <script type="text/javascript">
4
-
5
- function toggleById(item, link) {
6
- updateDisplayStatus(document.getElementById(item));
7
- toggleText(link)
8
- }
9
- function updateDisplayStatus(object) {
10
- object.style.display = (object.style.display == "block") ? 'none' : "block";
11
- }
12
- function toggleText(link) {
13
- var char_result = link.innerHTML.indexOf("+") > -1 ? "-" : "+";
14
- link.innerHTML = link.innerHTML.replace(/(\+|\-)/, char_result)
15
- }
16
-
17
-
18
- </script>
19
-
20
- <style>
21
- .title {
22
- padding-left: 1%;
23
- width: 25%;
24
- background-color: green;
25
- color: white;
26
- border-top: 0;
27
- border-bottom: 0;
28
- font-weight: bold;
29
- font-size: 21pt;
30
- cursor: pointer;
31
- }
32
-
33
- .shrink_section {
34
- border: 2px solid #90ee90;
35
- display: none;
36
- }
37
-
38
- .table_top {
39
- width: 20%;
40
- font-size: 14pt;
41
- padding: 0;
42
- }
43
-
44
- .divide_row {
45
- border-bottom: 1px solid black;
46
- }
47
-
48
- .red_number {
49
- width: 3%;
50
- color: red;
51
- text-indent: 1%;
52
- font-weight: bold;
53
- }
54
-
55
- .notes {
56
- font-weight: bold;
57
- }
58
-
59
- .sub_section {
60
- display: none;
61
- margin-left: 1%;
62
- margin-right: 1%;
63
- border-top: 2px solid #add8e6;
64
- }
65
-
66
- .empty_set_message {
67
- font-weight: bold;
68
- margin-left: 1%;
69
- }
70
-
71
- .rule_notes {
72
- margin-left: 1%;
73
- border-left: 2px solid #90ee90;
74
- border-top: 2px solid #90ee90;
75
- display: block;
76
- clear: left;
77
- padding-bottom: 0%;
78
- text-indent: 0%;
79
- padding-left: 0.5%;
80
- margin-bottom: 0.5%;
81
- }
82
-
83
- .rule_style {
84
- margin: 0;
85
- text_indent: 3%;
86
-
87
- }
88
- .rule_heading {
89
- font-weight: bold;
90
- margin: 0.25%;
91
- }
92
-
93
- ol {
94
- list-style-type:none;
95
- display: block;
96
- padding-left: 1%
97
-
98
- }
99
-
100
- </style>
101
-
102
- <div style="float: left; color: green; font-size: 20px; font-weight: bold; padding-bottom: 1px;">
103
- Cuke Sniffer
104
- </div>
105
- <br style="clear:both">
106
- <div style="border-top: 2px solid lightgreen; text-align: right;">
107
- <div style="float: right; background-color:green;border-right:2px solid #fff; color:white;padding:4px; padding-left:40px;font-size:11pt;font-weight:bold;padding-right:10px;">
108
- Score: <%= cuke_sniffer.summary[:total_score] %></div>
109
- </div>
110
- <br style="clear:both">
111
-
112
- <%
113
- legend = build_page(cuke_sniffer, "legend.html.erb")
114
- summary = build_page(cuke_sniffer, "summary.html.erb")
115
- rules = rules_template(cuke_sniffer)
116
- improvement_list = build_page(cuke_sniffer, "improvement_list.html.erb")
117
- %>
118
-
119
- <%= legend %>
120
-
121
- <%= summary %>
122
-
123
- <%= improvement_list %>
124
-
125
- <%= rules %>
1
+ <%
2
+ styles = build_page(cuke_sniffer, "css.html.erb")
3
+ scripts = build_page(cuke_sniffer, "js.html.erb")
4
+ title = build_page(cuke_sniffer, "title.html.erb")
5
+ legend = build_page(cuke_sniffer, "legend.html.erb")
6
+ summary = build_page(cuke_sniffer, "summary.html.erb")
7
+ rules = rules_template(cuke_sniffer)
8
+ improvement_list = build_page(cuke_sniffer, "improvement_list.html.erb")
9
+ %>
10
+
11
+ <%= styles %>
12
+ <%= scripts %>
13
+ <%= title %>
14
+ <%= summary %>
15
+ <%= improvement_list %>
16
+ <%= rules %>
@@ -1,9 +1,76 @@
1
- <div id="rulesTab" class="title" onclick="toggleById('rules', this)">
2
- Rules +
3
- </div>
4
-
5
- <div class="shrink_section" id="rules">
6
- <%= enabled_rules %>
7
- <%= disabled_rules %>
8
- </div>
1
+ <div id="rulesTab" class="title" onclick="toggleById('rules', this);updateDisplayStatus(document.getElementById('rules_function_bar'));updateDivScroll('rules', 'rules_table');">
2
+ Rules +
3
+ </div>
4
+
5
+ <div id="rules_function_bar" class="function_bar">
6
+ <input type="button" class="function_button" value="Collapse All" onclick="collapseAll('rule_detail')" />
7
+ <input type="button" class="function_button" value="Expand All" onclick="expandAll('rule_detail')" />
8
+ </div>
9
+
10
+ <div class="shrink_section" id="rules">
11
+ <table id="rules_table" style="width: 100%" border="0" cellspacing="0">
12
+ <% index = 0 %>
13
+ <% cuke_sniffer.rules.each do |rule| %>
14
+ <% if !rule.enabled %>
15
+ <tr class="notes disabled_title_row" onclick="updateDisplayStatus(document.getElementById('rule_detail_<%=index%>'));updateDivScroll('rules', 'rules_table');">
16
+ <% elsif index.odd? %>
17
+ <tr class="notes blue_title_row" onclick="updateDisplayStatus(document.getElementById('rule_detail_<%=index%>'));updateDivScroll('rules', 'rules_table');">
18
+ <% else %>
19
+ <tr class="notes white_title_row" onclick="updateDisplayStatus(document.getElementById('rule_detail_<%=index%>'));updateDivScroll('rules', 'rules_table');">
20
+ <% end %>
21
+
22
+ <td>
23
+ <%= rule.phrase %>
24
+ </td>
25
+ </tr>
26
+
27
+ <% if index.odd? %>
28
+ <tr id="rule_detail_<%= index %>" class="colored_subsection blue_row rule_detail" style="display:none;">
29
+ <% else %>
30
+ <tr id="rule_detail_<%= index %>" class="colored_subsection white_row rule_detail" style="display:none;">
31
+ <% end %>
32
+ <td style="padding-left:8px;">
33
+ <table border="0" cellspacing="0">
34
+ <tr>
35
+ <td>
36
+ <b>Score:</b> <%= rule.score %>
37
+ </td>
38
+ </tr>
39
+ <tr>
40
+ <td>
41
+ <b>Targets:</b> <%= rule.targets.to_s.gsub(/[\]\[\"]/, "") %>
42
+ </td>
43
+ </tr>
44
+ <% unless rule.conditions.empty? %>
45
+ <tr>
46
+ <td>
47
+ <b>Conditions:</b>
48
+ <table style="padding-left: 4px;">
49
+ <% rule.conditions.each do |condition_symbol, value| %>
50
+ <tr>
51
+ <td>
52
+ <%= condition_symbol %>:
53
+ </td>
54
+ <td>
55
+ <%= value %>
56
+ </td>
57
+ </tr>
58
+ <% end %>
59
+ </table>
60
+ </td>
61
+ </tr>
62
+ <% end %>
63
+ <tr>
64
+ <td>
65
+ <b>Reason: </b><%= rule.reason %>
66
+ </td>
67
+ </tr>
68
+ </table>
69
+ </td>
70
+ </tr>
71
+
72
+ <% index += 1 %>
73
+ <% end %>
74
+ </table>
75
+ </div>
9
76
  <br style="clear:both">
@@ -1,137 +1,24 @@
1
- <link rel="stylesheet" type="text/css" >
2
-
3
- <script type="text/javascript">
4
-
5
- function toggleById(item, link) {
6
- updateDisplayStatus(document.getElementById(item));
7
- toggleText(link)
8
- }
9
- function updateDisplayStatus(object) {
10
- object.style.display = (object.style.display == "block") ? 'none' : "block";
11
- }
12
- function toggleText(link) {
13
- var char_result = link.innerHTML.indexOf("+") > -1 ? "-" : "+";
14
- link.innerHTML = link.innerHTML.replace(/(\+|\-)/, char_result)
15
- }
16
-
17
-
18
- </script>
19
-
20
- <style>
21
- .title {
22
- padding-left: 1%;
23
- width: 25%;
24
- background-color: green;
25
- color: white;
26
- border-top: 0;
27
- border-bottom: 0;
28
- font-weight: bold;
29
- font-size: 21pt;
30
- cursor: pointer;
31
- }
32
-
33
- .shrink_section {
34
- border: 2px solid #90ee90;
35
- display: none;
36
- }
37
-
38
- .table_top {
39
- width: 20%;
40
- font-size: 14pt;
41
- padding: 0;
42
- }
43
-
44
- .divide_row {
45
- border-bottom: 1px solid black;
46
- }
47
-
48
- .red_number {
49
- width: 3%;
50
- color: red;
51
- text-indent: 1%;
52
- font-weight: bold;
53
- }
54
-
55
- .notes {
56
- font-weight: bold;
57
- }
58
-
59
- .sub_section {
60
- display: none;
61
- margin-left: 1%;
62
- margin-right: 1%;
63
- border-top: 2px solid #add8e6;
64
- }
65
-
66
- .empty_set_message {
67
- font-weight: bold;
68
- margin-left: 1%;
69
- }
70
-
71
- .rule_notes {
72
- margin-left: 1%;
73
- border-left: 2px solid #90ee90;
74
- border-top: 2px solid #90ee90;
75
- display: block;
76
- clear: left;
77
- padding-bottom: 0%;
78
- text-indent: 0%;
79
- padding-left: 0.5%;
80
- margin-bottom: 0.5%;
81
- }
82
-
83
- .rule_style {
84
- margin: 0;
85
- text_indent: 3%;
86
-
87
- }
88
- .rule_heading {
89
- font-weight: bold;
90
- margin: 0.25%;
91
- }
92
-
93
- ol {
94
- list-style-type:none;
95
- display: block;
96
- padding-left: 1%
97
-
98
- }
99
-
100
- </style>
101
-
102
- <div style="float: left; color: green; font-size: 20px; font-weight: bold; padding-bottom: 1px;">
103
- Cuke Sniffer
104
- </div>
105
- <br style="clear:both">
106
- <div style="border-top: 2px solid lightgreen; text-align: right;">
107
- <div style="float: right; background-color:green;border-right:2px solid #fff; color:white;padding:4px; padding-left:40px;font-size:11pt;font-weight:bold;padding-right:10px;">
108
- Score: <%= cuke_sniffer.summary[:total_score] %></div>
109
- </div>
110
- <br style="clear:both">
111
-
112
1
  <%
113
- legend = build_page(cuke_sniffer, "legend.html.erb")
114
- summary = build_page(cuke_sniffer, "summary.html.erb")
115
- rules = rules_template(cuke_sniffer)
116
- improvement_list = build_page(cuke_sniffer, "improvement_list.html.erb")
117
- dead_steps = build_page(cuke_sniffer, "dead_steps.html.erb")
118
- features = build_page(cuke_sniffer, "features.html.erb")
119
- step_definitions = build_page(cuke_sniffer, "step_definitions.html.erb")
120
- hooks = build_page(cuke_sniffer, "hooks.html.erb")
2
+ styles = build_page(cuke_sniffer, "css.html.erb")
3
+ scripts = build_page(cuke_sniffer, "js.html.erb")
4
+ title = build_page(cuke_sniffer, "title.html.erb")
5
+ legend = build_page(cuke_sniffer, "legend.html.erb")
6
+ summary = build_page(cuke_sniffer, "summary.html.erb")
7
+ rules = rules_template(cuke_sniffer)
8
+ improvement_list = build_page(cuke_sniffer, "improvement_list.html.erb")
9
+ dead_steps = build_page(cuke_sniffer, "dead_steps.html.erb")
10
+ features = build_page(cuke_sniffer, "features.html.erb")
11
+ step_definitions = build_page(cuke_sniffer, "step_definitions.html.erb")
12
+ hooks = build_page(cuke_sniffer, "hooks.html.erb")
121
13
  %>
122
14
 
123
- <%= legend %>
124
-
15
+ <%= styles %>
16
+ <%= scripts %>
17
+ <%= title %>
125
18
  <%= summary %>
126
-
127
19
  <%= improvement_list %>
128
-
129
20
  <%= rules %>
130
-
131
21
  <%= dead_steps %>
132
-
133
22
  <%= features %>
134
-
135
23
  <%= step_definitions %>
136
-
137
24
  <%= hooks %>