This repository has been archived by the owner on Nov 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from bthuilot/fixing_styling
Fixing styling
- Loading branch information
Showing
18 changed files
with
182 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,4 @@ | |
//= require jquery | ||
//= require popper | ||
//= require bootstrap | ||
//= require material | ||
//= require_tree . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
.breadcrumb-post i { | ||
display: inline-flex; | ||
vertical-align: middle; | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class SystemPage < ApplicationRecord | ||
validates :name, uniqueness: true, presence: true, length: {maximum: 50} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,60 @@ | ||
<nav class="flex-column"> | ||
<h3>Categories</h3> | ||
<hr/> | ||
<% @categories.each do |category| %> | ||
<a class='no-underline-link' data-toggle="collapse" href="#collapse-<%= category.name.parameterize %>-dropdown" role="button" aria-expanded="false" aria-controls="collapse-<%= category.name.parameterize %>-dropdown"> | ||
<h4 class="text-muted"><%= category.name %> <i data-toggle="collapse" class="material-icons">arrow_drop_down</i> | ||
</h4> | ||
</a> | ||
<div class="collapse" id="collapse-<%= category.name.parameterize %>-dropdown"> | ||
<% category.posts.each do |post| %> | ||
<ul class="navbar-nav"> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="<%= post_url(post) %>"><%= post.title %></a> | ||
</li> | ||
</ul> | ||
<nav data-spy="scroll" class="navbar navbar-expand-md flex-column pt-0 px-0"> | ||
<div class="row"> | ||
<div class="col-md-12 col-11"> | ||
<%= form_for :search, method: :get, url: '/search' do |form| %> | ||
<div class="form-row"> | ||
<div class="form-group col-md-12 col-6"> | ||
<%= form.text_field :term, class: 'form-control', placeholder: "Search Posts..." %> | ||
</div> | ||
<div class="form-group col-md-8 col-4"> | ||
<%= form.select :category, Category.all.collect {|c| [c.name, c.id]}, {include_blank: 'All Categories'}, {class: 'custom-select'} %> | ||
</div> | ||
<div class="form-group col-md-4 col-2"> | ||
<%= form.submit :search, value: "Search", class: 'btn btn-primary' %> | ||
</div> | ||
|
||
</div> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</nav> | ||
<div class="col-md-12 col-1"> | ||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#sidebarCollapse" aria-controls="sidebarCollapse" aria-expanded="false" aria-label="Toggle navigation"> | ||
<%= octicon "three-bars", height: 32 %> | ||
</button> | ||
</div> | ||
</div> | ||
<div class="collapse navbar-collapse" id="sidebarCollapse"> | ||
<div class="row"> | ||
<% @categories.each do |category| %> | ||
<div class="col-12"> | ||
<div class="accordion mt-2" id="category-accordion"> | ||
<div class="card"> | ||
<div class="card-header" id="category-<%= category.id %>-heading"> | ||
<h2 class="mb-0"> | ||
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#category-<%= category.id %>-collapse" aria-expanded="true" aria-controls="category-<%= category.id %>-collapse"> | ||
<%= category.name %> | ||
</button> | ||
</h2> | ||
</div> | ||
|
||
<div id="category-<%= category.id %>-collapse" class="collapse | ||
<% if (@category && @category.id == category.id) || (@post && @post.category && @post.category.id == category.id) %>show | ||
<% end %>" aria-labelledby="category" data-parent="#category-accordion"> | ||
<div class="card-body"> | ||
<ul class="nav flex-column"> | ||
<% category.posts.each do |post| %> | ||
<li class="nav-item"> | ||
<a class="nav-link | ||
<% if @post && @post.id == post.id %> | ||
<% end %>" href="<%= post_path(post) %>"><%= post.title %></a> | ||
</li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,30 @@ | ||
require 'test_helper' | ||
|
||
class CategoryTest < ActiveSupport::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
|
||
setup do | ||
@category = Category.new({name: "Test Category", homepage: "# Hello World!!"}) | ||
end | ||
|
||
test "Valid category" do | ||
assert @category.valid?, "Category with unique name and a homepage" | ||
end | ||
|
||
test "Category missing name" do | ||
@category.name = nil | ||
refute @category.valid?, "Category with missing name" | ||
assert_not_nil @category.errors[:name] | ||
end | ||
|
||
test "Category non unique name" do | ||
@category.name = "Finance Category" | ||
refute @category.valid?, "Category with duplicate name" | ||
assert_not_nil @category.errors[:name] | ||
end | ||
|
||
test "Category name longer than 50 characters" do | ||
@category.name = "-" * 51 | ||
refute @category.valid?, "Category with name longer than 50" | ||
assert_not_nil @category.errors[:name] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,28 @@ | ||
require 'test_helper' | ||
|
||
class PostTest < ActiveSupport::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
setup do | ||
@post = Post.new({title: "Test Post", contents: "# Hello World!!", category: categories(:dev_ops)}) | ||
end | ||
|
||
test "Valid post" do | ||
assert @post.valid?, "Post with title, category, and a contents" | ||
end | ||
|
||
test "Post is missing category" do | ||
@post.category = nil | ||
refute @post.valid? | ||
end | ||
|
||
test "Post missing title" do | ||
@post.title = nil | ||
refute @post.valid?, "Post with missing title" | ||
assert_not_nil @post.errors[:title] | ||
end | ||
|
||
test "Post title longer than 50 characters" do | ||
@post.title = "-" * 51 | ||
refute @post.valid?, "Post with title longer than 50" | ||
assert_not_nil @post.errors[:title] | ||
end | ||
end |
Oops, something went wrong.