Skip to content
Open
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: 4 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,8 @@ $(document).ready(function(){
}
});
});

$(function(){
$(':input[type=number]').on('mousewheel',function(e){ $(this).blur(); });
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Seems like you opted for a JS solution to keep the field type as number. For that let's make use of the number field and as a min option for it (minimum team size should be 1 and min tech team size should be 0)

});
4 changes: 4 additions & 0 deletions app/assets/stylesheets/organizations.scss
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,8 @@ div.container {
#twitter-feed {
padding-left: 0;
padding-right: 0;
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
4 changes: 4 additions & 0 deletions app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ class Organization < ActiveRecord::Base
validates :address, presence: true
validates :overview, presence: true
validates :employee_count, presence: true, numericality: {greater_than_or_equal_to: 1}
<<<<<<< 2db89f4dea0289fa69e2f4f1fe1cea229493226f
validates :tech_team_size, presence: true, numericality: {greater_than_or_equal_to: 1}
validate :reasonable_tech_team_size
=======
validates :tech_team_size, presence: true, numericality: {greater_than_or_equal_to: 0}
>>>>>>> validation testing

has_many :organization_technologies, dependent: :destroy
has_many :technologies, through: :organization_technologies
Expand Down
34 changes: 16 additions & 18 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,23 @@
<%= yield %>
</div>

<div class="bottomMenu navbar-fixed-bottom navbar-inverse">
<div class="navbar-left footer pull-left text-left">
<ul class="nav navbar-nav">
<li><%= link_to "About", about_path %></li>
<%if user_signed_in?%>
<% if current_user.missing_organization? && !current_user.admin?%>
<li class="li-nav"><%= link_to "Create Organization", new_organization_path, class:"directory" %></li>
<li class="user-profile"><%= link_to "Log out", sessions_path, method: :delete %></li>
<% elsif !current_user.admin? %>
<li class="li-nav"><%= link_to "My Organization", organization_path(current_user.organization), class:"directory" %></li>
<li class="user-profile"><%= link_to "Log out", sessions_path, method: :delete %></li>
<% end %>
<% else %>
<li><%= link_to "Create Organization", new_organization_path %></li>
<li class="li-nav"><%= link_to "Sign In", new_session_path %></li>
<li class="li-nav"> <%= link_to "Sign Up", new_user_path, id: "btn-sign-up" %></li>
<div class="bottomMenu navbar-fixed-bottom navbar-inverse">
<div class="navbar-left footer pull-left text-left">
<ul class="nav navbar-nav">
<li><%= link_to "About", about_path %></li>
<%if user_signed_in?%>
<% if current_user.missing_organization? && !current_user.admin?%>
<li class="li-nav"><%= link_to "Create Organization", new_organization_path, class:"directory" %></li>
<li class="user-profile"><%= link_to "Log out", sessions_path, method: :delete %></li>
<% elsif !current_user.admin? %>
<li class="li-nav"><%= link_to "My Organization", organization_path(current_user.organization), class:"directory" %></li>
<li class="user-profile"><%= link_to "Log out", sessions_path, method: :delete %></li>
<% end %>
</ul>
</div>
<% else %>
<li><%= link_to "Create Organization", new_organization_path %></li>
<% end %>
</ul>
</div>
<div class="navbar-right footer-icons">
<a href="https://github.com/CodeCoreYVR/vancouvertechhub" alt="GitHub" target="_blank" ><i class="fa fa-github" aria-hidden="true"></i></a>
<a href="https://twitter.com/CodeCoreYVR" alt="Twitter" target="_blank" ><i class="fa fa-twitter" aria-hidden="true"></i></a>
Expand Down
5 changes: 3 additions & 2 deletions app/views/organizations/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<%= f.input :name, input_html: {class: "abc"}, label_html: {class: "hey"} %>
<%= f.input :address %>
<%= f.input :overview %>
<%= f.input :employee_count %>
<%= f.input :tech_team_size %>
<%= f.input :employee_count, {label: "Employee Count"} %>
<%= f.input :tech_team_size, {label: "Tech Team Size"} %>
<%= f.input :website %>
<%= f.input :twitter %>
<%#= f.input :manager %>
Expand All @@ -15,5 +15,6 @@
<%= f.file_field :image2 %>
<%= f.file_field :image3 %>
<%= f.file_field :image4 %>
<hr>
<%= f.submit class: "btn btn-primary" %>
<% end %>
5 changes: 5 additions & 0 deletions coverage/.last_run.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"result": {
"covered_percent": 100.0
}
}
7 changes: 7 additions & 0 deletions coverage/.resultset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"RSpec": {
"coverage": {
},
"timestamp": 1469123623
}
}
72 changes: 72 additions & 0 deletions coverage/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Code coverage for Vancouvertechhub</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src='./assets/0.10.0/application.js' type='text/javascript'></script>
<link href='./assets/0.10.0/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
<link rel="shortcut icon" type="image/png" href="./assets/0.10.0/favicon_green.png" />
<link rel="icon" type="image/png" href="./assets/0.10.0/favicon.png" />
</head>

<body>
<div id="loading">
<img src="./assets/0.10.0/loading.gif" alt="loading"/>
</div>
<div id="wrapper" style="display:none;">
<div class="timestamp">Generated <abbr class="timeago" title="2016-07-21T10:53:43-07:00">2016-07-21T10:53:43-07:00</abbr></div>
<ul class="group_tabs"></ul>

<div id="content">
<div class="file_list_container" id="AllFiles">
<h2>
<span class="group_name">All Files</span>
(<span class="covered_percent"><span class="green">100.0%</span></span>
covered at
<span class="covered_strength">
<span class="red">
0.0
</span>
</span> hits/line)
</h2>
<a name="AllFiles"></a>
<div>
<b>0</b> files in total.
<b>0.0</b> relevant lines.
<span class="green"><b>0.0</b> lines covered</span> and
<span class="red"><b>0.0</b> lines missed </span>
</div>
<table class="file_list">
<thead>
<tr>
<th>File</th>
<th>% covered</th>
<th>Lines</th>
<th>Relevant Lines</th>
<th>Lines covered</th>
<th>Lines missed</th>
<th>Avg. Hits / Line</th>
</tr>
</thead>
<tbody>

</tbody>
</table>
</div>



</div>

<div id="footer">
Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.11.2
and simplecov-html v0.10.0<br/>
using RSpec
</div>

<div class="source_files">

</div>
</div>
</body>
</html>
Binary file added dump.rdb
Binary file not shown.
10 changes: 10 additions & 0 deletions spec/models/organization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
it "should have employees" do
o = Organization.new FactoryGirl.attributes_for(:organization).merge({employee_count: 0})
expect(o).to be_invalid
it "requires the employee count to be greater than or equal to 1" do
o = Organization.new employee_count: 5
o.valid?
expect(o.errors).to have_key(:employee_count)
end

it "requires the tech team size to be greater than or equal to 0" do
o = Organization.new tech_team_size: 5
o.valid?
expect(o.errors).to have_key(:tech_team_size)
end
end
end