Skip to content

Commit

Permalink
Merge pull request #8 from aleksey-hariton/COD-1958_tags_in_attributes
Browse files Browse the repository at this point in the history
tags in attributes
  • Loading branch information
aleksey-hariton committed Apr 21, 2016
2 parents bb7452f + 5116d01 commit 5f058aa
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 5 deletions.
7 changes: 7 additions & 0 deletions templates/default/attribute/html/attribute.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<%=
if object.type == :cookbook
erb(:cookbook_attribute)
else
erb(:resource_attribute)
end
%>
2 changes: 1 addition & 1 deletion templates/default/attribute/html/attribute_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
%>

<% if @attributes.size > 0 %>
<%= object.type == :resource ? "<h4>Attributes</h4>" : "<h2>Cookbook Attributes</h2>"%>
<%= object.type == :resource ? '<h4>Attributes</h4>' : '<h2>Cookbook Attributes</h2>'%>
<ul><%= yieldall %></ul>
<% end %>
33 changes: 33 additions & 0 deletions templates/default/attribute/html/cookbook_attribute.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<% @attributes.each do |attribute| %>
<h3><strong><%= attribute.name %></strong></h3>
<div class="row">
<div class="col-md-12">
<p>
<strong>Description</strong><br />
</p>
<%= htmlify attribute.docstring %>
<%= yieldall :object => attribute, :owner => object %>
</div>
</div>
<div class="row">
<div class="col-md-12">
<p>
<strong>JSON and default value</strong>
</p>
<table class="table table-hover">
<tr>
<th>JSON</th>
<th>Default value</th>
</tr>
<tr>
<td>
<% if object.type == :cookbook %>
<%= htmlify attribute.to_json %>
<% end %>
</td>
<td><%= htmlify attribute.default %></td>
</tr>
</table>
</div>
</div>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<br /><span>[<a href="#" onclick="return false;" class="toggleSource">View JSON</a>]</span><br /><span class="source_code"><%= htmlify attribute.to_json %></span>
<% end %>
</td>
<td><%= htmlify attribute.docstring %></td>
<td>
<%= htmlify attribute.docstring %>
<%= yieldall :object => attribute, :owner => object %>
</td>
<% if object.type == :resource %>
<td><%= attribute.kind_of %></td>
<% end %>
Expand Down
3 changes: 2 additions & 1 deletion templates/default/attribute/html/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
def init
@attributes = object.children_by_type(:attribute)

sections.push :attribute_header, [:table]
sections.push :attribute_header
sections.push :attribute, [T('chef_tags')]
end
2 changes: 1 addition & 1 deletion templates/default/chef_tags/html/note.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<p class="tag_title">Notes:</p>
<div class="notes">
<% object.tags(:note).each do |tag| %>
<div class="alert alert-danger">
<div class="alert alert-info">
<p><%= htmlify(tag.text) %></p>
</div>
<% end %>
Expand Down
28 changes: 27 additions & 1 deletion templates/default/fulldoc/html/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,30 @@ ul.summary {
ul.summary li.action{
border-top: 1px dotted #aaa;
padding-top: 8px;
}
}


#toc {
padding: 20px;
/* padding-right: 30px; */
border: 1px solid #ddd;
float: right;
background: #fff;
margin-left: 20px;
margin-bottom: 20px;
max-width: 500px;
-webkit-box-shadow: -2px 2px 6px #bbb;
-moz-box-shadow: -2px 2px 6px #bbb;
z-index: 5000;
position: relative;
overflow-x: auto;
}
#toc.nofloat { float: none; max-width: none; border: none; padding: 0; margin: 20px 0; -webkit-box-shadow: none; -moz-box-shadow: none; }
#toc.nofloat.hidden { padding: 0; background: 0; margin-bottom: 5px; }
#toc .title { margin: 0; }
#toc ol {padding-left: 1em;list-style-type: none;}
#toc li {font-size: 1.1em;line-height: 1.7em;}
#toc > ol > li { font-size: 1.1em; font-weight: bold; }
#toc ol > ol {font-size: 0.9em;}
#toc ol ol > ol {padding-left: 1em;}
#toc ol + li { margin-top: 0.3em; }

0 comments on commit 5f058aa

Please sign in to comment.