Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filters on style guide #218

Merged
merged 3 commits into from
Mar 14, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/helpers/filter_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module FilterHelper
def filter_option_link(site, type, options = {})
selected = options[:selected]

link_to filter_site_mappings_path(@site),
link_to filter_site_mappings_path(site),
'class' => "filter-option #{'filter-selected' if selected}",
'data-toggle' => 'dropdown',
'role' => 'button' do
Expand All @@ -11,7 +11,7 @@ def filter_option_link(site, type, options = {})
end

def filter_remove_option_link(site, type, type_sym)
link_to site_mappings_path(@site, params.except(type_sym, :page)), title: 'Remove filter', class: 'filter-option filter-selected' do
link_to site_mappings_path(site, params.except(type_sym, :page)), title: 'Remove filter', class: 'filter-option filter-selected' do
"<span class=\"glyphicon glyphicon-remove\"></span><span class=\"rm\">Remove</span> #{type}".html_safe
end
end
Expand Down
81 changes: 79 additions & 2 deletions app/views/style/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@
<p>To match bootstrap’s muted text, a muted link class is available.</p>
<p>Transition has also added purple <code>:visited</code> styles. These apply to the main content but not to buttons.</p>
</div>
<ul class="col-md-6">
<div class="col-md-6">
<a href="/style" class="link-muted">Muted link</a><br><br>
<a href="/style">Visited link</a><br><br>
<a href="/style#<%= "#{Time.now.utc.to_i}" %>">Normal link</a><br><br>
<a href="/style" class="btn btn-default">Visited button link</a><br><br>
<a href="/style" class="btn btn-success">Another visited button link</a><br><br>
</ul>
</div>
</div>
<hr>

Expand Down Expand Up @@ -245,6 +245,83 @@
</div>
<hr>

<h2>Filters</h2>
<div class="row filters">
<div class="col-md-6 lead">
<p>Filters use bootstrap’s default <code>panel</code> styles in combination with the <code>nav-pill</code> navigation pattern. When no filters are active the <code>panel-body</code> isn’t present.</p>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<header class="panel-heading">
<ul class="nav nav-compact nav-pills">
<li class="if-no-js-hide nav-pill-text">
<strong>Heading</strong>
</li>
<li class="if-no-js-hide">
<a href="#" class="filter-option" data-toggle="dropdown" role="button">
Filter <span class="glyphicon glyphicon-chevron-down"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#">Filter options</a>
</li>
</ul>
</li>
<li class="nav-pill-text text-muted">
Text
</li>
</ul>
</header>
</div>
</div>
</div>
<div class="row filters">
<div class="col-md-6 lead">
<p>When active, each filter can be removed individually, or all filters reset. Some filters are either on or off. Others can change their values, in this case the filter menu remains, alongside the remove link.</p>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<header class="panel-heading">
<a href="#" class="remove-filters">
<span class="glyphicon glyphicon-remove"></span>
</a>
<ul class="nav nav-compact nav-pills">
<li class="if-no-js-hide nav-pill-text">
<strong>Heading</strong>
</li>
<li class="if-no-js-hide selected-and-available">
<a href="#" class="filter-option filter-selected" title="Remove filter">
<span class="glyphicon glyphicon-remove"></span>
<span class="rm">Remove</span>
</a>
<a href="#" class="filter-option filter-selected" data-toggle="dropdown" role="button">
Filter with options <span class="glyphicon glyphicon-chevron-down"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#">Filter options</a>
</li>
</ul>
</li>
<li>
<a href="#" class="filter-option filter-selected" title="Remove filter">
<span class="glyphicon glyphicon-remove"></span>
<span class="rm">Remove</span> Boolean filter
</a>
</li>
</ul>
</header>
<div class="alert alert-warning">
Filter warning
</div>
<div class="panel-body">
Active filter options
</div>
</div>
</div>
</div>
<hr>

<h2>Pagination</h2>
<div class="row">
<p class="lead col-md-6">Markup generated by <a href="https://github.com/amatsuda/kaminari">kaminari</a>, using the default template but with custom styles intended to mimic bootstrap.</p>
Expand Down