Skip to content

Commit 0ee21ce

Browse files
author
Jake Varghese
committed
adding tabs and some cleanup
1 parent 799aaa8 commit 0ee21ce

17 files changed

+204
-63
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*.rbc
22
capybara-*.html
33
.rspec
4+
.vscode
45
/log
56
/tmp
67
/db/*.sqlite3

.vscode/settings.json

-3
This file was deleted.

app/admin/projects.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
f.inputs "Selections" do
7171
f.input :lead_ids, :input_html => { multiple: true, size: 60, class: 'select2' }
7272

73-
f.input :skills, :input_html => { multiple: true, size: 60, class: 'select2' }
73+
f.input :stacks, :input_html => { multiple: true, size: 60, class: 'select2' }
7474

7575
f.input :volunteers, :input_html => { multiple: true, size: 60, class: 'select2' }
7676
end

app/controllers/dashboard/projects_controller.rb

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
class Dashboard::ProjectsController < Dashboard::BaseController
22
inherit_resources
3+
4+
def all
5+
@projects = Project.order("name ASC").includes(:stacks).all
6+
end
37

48
def create
59
@project = Project.new(project_params)
@@ -16,6 +20,10 @@ def create
1620
render :edit
1721
end
1822
end
23+
24+
def show
25+
@project = Project.find(params[:id])
26+
end
1927

2028
def edit
2129
if resource.mission_aligned
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Dashboard::SkillsController < Dashboard::BaseController
2+
inherit_resources
3+
before_action :authenticate_user!
4+
5+
6+
end

app/controllers/skills_controller.rb

-6
This file was deleted.

app/models/project.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Project < ApplicationRecord
1616

1717
validates_presence_of :name, :description, :tech_stack, :tech_stack_names
1818

19-
validates :legal_structures, :presence => true,:allow_blank => false
19+
validates :legal_structures, :presence => true, :allow_blank => false, :if => :new_record?
2020

2121
after_save :remove_blank_values
2222
audited
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<p id="notice"><%= notice %></p>
2+
3+
<h1>All Projects</h1>
4+
5+
6+
<div class="table-responsive">
7+
<table class="table table-striped table-sm">
8+
<thead>
9+
<tr>
10+
<th>#</th>
11+
<th>Name</th>
12+
<th>Description</th>
13+
<th>Skills</th>
14+
<th>Created</th>
15+
</tr>
16+
</thead>
17+
<tbody>
18+
<% @projects.each do |project| %>
19+
<tr>
20+
<td><%= project.id %></td>
21+
<td><%= link_to project.name, dashboard_project_path(project) %></td>
22+
<td><%= project.description.try(:truncate, 100) %></td>
23+
<td><%= project.stacks.map(&:name).to_sentence %></td>
24+
<td><%= project.created_at.to_date %></td>
25+
</tr>
26+
<% end %>
27+
28+
</tbody>
29+
</table>
30+
</div>
31+
<br>
+46-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,50 @@
11
<h1>Edit Project</h1>
2-
32
<%= render 'shared/invalid_skill_modal'%>
3+
<hr />
4+
<ul class="nav nav-tabs" id="myTab" role="tablist">
5+
<li class="nav-item">
6+
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Info</a>
7+
</li>
8+
<li class="nav-item">
9+
<a class="nav-link" id="profile-tab" data-toggle="tab" href="#volunteers" role="tab" aria-controls="profile" aria-selected="false">Volunteers</a>
10+
</li>
11+
</ul>
12+
<div class="tab-content" id="myTabContent">
13+
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
14+
<p>&nbsp;</p>
15+
<% if resource.mission_aligned %>
16+
<%= render 'aligned_form'%>
17+
<% else %>
18+
<%= render 'new_form', dashboard_project: @dashboard_project %>
19+
<% end %>
20+
21+
</div>
22+
<div class="tab-pane fade" id="volunteers" role="tabpanel" aria-labelledby="profile-tab">
23+
<table class="table table-striped">
24+
<thead>
25+
<tr>
26+
<th scope="col">#</th>
27+
<th scope="col">Name</th>
28+
<th scope="col">Slackname</th>
29+
<th scope="col">Status</th>
30+
</tr>
31+
</thead>
32+
<tbody>
33+
<% resource.volunteerings.includes(:user).each do |vol| %>
34+
<tr>
35+
<th scope="row">1</th>
36+
<td><%= vol.user.name %></td>
37+
<td><%= vol.user.slack_username %></td>
38+
<td><%= vol.state %></td>
39+
</tr>
40+
<% end %>
41+
</tbody>
42+
</table>
43+
44+
</div>
45+
</div>
46+
447

5-
<% if resource.mission_aligned%>
6-
<%= render 'aligned_form'%>
7-
<% else %>
8-
<%= render 'new_form', dashboard_project: @dashboard_project %>
9-
<% end %>
1048

11-
<%= link_to 'Back', dashboard_projects_path %>
49+
<hr />
50+
<%= link_to 'Back', dashboard_projects_path, :class => "btn btn-success" %>

app/views/dashboard/projects/index.html.erb

+2-21
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,16 @@
2323
<td><%= project.id %></td>
2424
<td><%= project.name %></td>
2525
<td><%= project.status %></td>
26-
<td><%= project.description %></td>
26+
<td><%= project.description.try(:truncate, 100) %></td>
2727
<td><%= project.website %></td>
2828
<td><%= project.slack_channel %></td>
2929
<td><%= project.created_at.to_date %></td>
30-
<td><%= link_to 'Edit', edit_dashboard_project_path(project) %></td>
30+
<td><%= link_to 'Edit', edit_dashboard_project_path(project), :class => "btn btn-info" %></td>
3131
</tr>
3232
<% end %>
3333

3434
</tbody>
3535
</table>
3636
</div>
37-
<table>
38-
<thead>
39-
<tr>
40-
<th colspan="3"></th>
41-
</tr>
42-
</thead>
43-
44-
<tbody>
45-
<% collection.each do |project| %>
46-
<tr>
47-
<td><%= link_to 'Show', project_path(project) %></td>
48-
<td><%= link_to 'Edit', edit_dashboard_project_path(project) %></td>
49-
<td><%= link_to 'Destroy', dashboard_project_path(project), method: :delete, data: { confirm: 'Are you sure?' } %></td>
50-
</tr>
51-
<% end %>
52-
</tbody>
53-
</table>
54-
55-
<br>
5637

5738
<%= link_to 'New Project', new_dashboard_project_path, :class => "btn btn-success" %>
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
<h1><%= resource.name %></h1>
3+
4+
<p><b>Description:</b></p>
5+
<p><%= resource.description %></p>
6+
7+
<% if resource.slack_channel.present? %>
8+
<p><b>Slack Channel:</b></p>
9+
<p><%= link_to resource.slack_channel, 'slack://channel?team=T1KR8AG7J&id=' + resource.slack_channel %></p>
10+
<% end %>
11+
12+
13+
<% contributor_attributes(resource).each do |key, values| %>
14+
<% if values.present? %>
15+
<p><b><%= key.humanize %></b></p>
16+
<ul>
17+
<% values.each do |value| %>
18+
19+
<li><%= link_to value.name, 'slack://user?team=T1KR8AG7J&id=' + value.slack_userid %></li>
20+
21+
<% end %>
22+
</ul>
23+
<% end %>
24+
<% end %>
25+
26+
<p><b>Tech Stack:</b></p>
27+
<ul>
28+
<% resource.tech_stack.each do |skill| %>
29+
<li><%= link_to skill.name, [:dashboard, skill] %></li>
30+
<% end %>
31+
</ul>
32+
33+
<p><b>Non-Tech Stack:</b></p>
34+
<ul>
35+
<% resource.non_tech_stack.each do |skill| %>
36+
<li><%= link_to skill.name, [:dashboard, skill] %></li>
37+
<% end %>
38+
</ul>
39+
40+
<p><b>Needs Categories:</b></p>
41+
<ul>
42+
<% resource.needs_categories.each do |skill| %>
43+
<li><%= link_to skill.name, [:dashboard, skill] %></li>
44+
<% end %>
45+
</ul>
46+
47+
48+
<% scrubbed_attributes(resource).each do |key, value| %>
49+
<% if value.present? %>
50+
<p><b><%= key.humanize %></b></p>
51+
<p><%= value %></p>
52+
<% end %>
53+
<% end %>
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
<h1>All Skills</h1>
3+
<hr />
4+
5+
<ul class="nav nav-tabs" id="myTab" role="tablist">
6+
<li class="nav-item">
7+
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#tech" role="tab" aria-controls="home" aria-selected="true">Tech Skills</a>
8+
</li>
9+
<li class="nav-item">
10+
<a class="nav-link" id="profile-tab" data-toggle="tab" href="#nontech" role="tab" aria-controls="profile" aria-selected="false">Non-Tech Skills</a>
11+
</li>
12+
</ul>
13+
14+
<div class="tab-content" id="myTabContent">
15+
<div class="tab-pane fade show active" id="tech" role="tabpanel" aria-labelledby="home-tab">
16+
<div class="row mt-3">
17+
<% collection.tech_skills.each_with_index do |skill, idx| %>
18+
<div class="col">
19+
<%= link_to skill.name, [:dashboard, skill], :class => "list-group-item list-group-item-action" %>
20+
</div>
21+
<%= content_tag(:div, "", :class => "w-100") if (idx + 1) % 3 == 0 %>
22+
<% end %>
23+
</div>
24+
</div>
25+
<div class="tab-pane fade" id="nontech" role="tabpanel" aria-labelledby="profile-tab">
26+
27+
<div class="row mt-3">
28+
<% collection.non_tech_skills.each_with_index do |skill, idx| %>
29+
<div class="col">
30+
<%= link_to skill.name, [:dashboard, skill], :class => "list-group-item list-group-item-action" %>
31+
</div>
32+
<%= content_tag(:div, "", :class => "w-100") if (idx + 1) % 3 == 0 %>
33+
<% end %>
34+
</div>
35+
</div>
36+
<hr />
37+
</div>

app/views/skills/show.html.erb renamed to app/views/dashboard/skills/show.html.erb

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
<ul>
66
<% resource.projects.each do |project| %>
7-
<li> <%= link_to project.name, project %></li>
7+
<li> <%= link_to project.name, [:dashboard, project] %></li>
88
<% end %>
99
</ul>
1010

1111
<h2>Projects Needing this Skill</h2>
1212
<ul>
1313
<% resource.project_needs.each do |project| %>
14-
<li><%= link_to project.name, project %></li>
14+
<li><%= link_to project.name, [:dashboard, project] %></li>
1515
<% end %>
1616
</ul>

app/views/layouts/dashboard.html.erb

+8-3
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,17 @@
5757
</a>
5858
</li>
5959
<li class="nav-item">
60-
<a class="nav-link" href="/skills">
61-
Browse Projects by Skills
60+
<a class="nav-link" href="<%= dashboard_skills_path %>">
61+
<span data-feather="git-merge"></span>
62+
Projects by Skills
6263
</a>
6364
</li>
6465
<li class="nav-item">
65-
<a class="nav-link" href="/projects">Browse Projects Alphabetically</a>
66+
67+
<a class="nav-link" href="<%= all_dashboard_projects_path %>">
68+
<span data-feather="layers"></span>
69+
All Projects
70+
</a>
6671
</li>
6772
</ul>
6873
</div>

app/views/skills/index.html.erb

-13
This file was deleted.

config/routes.rb

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
root :to => 'base#index'
55
get 'base/index'
66
resource :user, only: [:edit, :update]
7-
resources :projects
7+
resources :skills, only: [:index, :show]
8+
resources :projects do
9+
get 'all', :on => :collection
10+
end
811
end
912

1013
scope :existing do
@@ -26,8 +29,8 @@
2629
end
2730

2831
devise_for :users, except: [:index], controllers: {
29-
sessions: 'users/sessions', omniauth_callbacks: 'users/omniauth_callbacks', users: 'users'
30-
}, :path => 'devise'
32+
sessions: 'users/sessions', omniauth_callbacks: 'users/omniauth_callbacks', users: 'users'
33+
}, :path => 'devise'
3134

3235
devise_scope :user do
3336
get 'sign_in', :to => 'devise/sessions#new', :as => :user_session
@@ -38,7 +41,6 @@
3841

3942
resources :projects, only: [:show, :index]
4043

41-
resources :skills, only: [:index, :show]
4244

4345
post 'slack/search'
4446

db/schema.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
t.datetime "created_at", null: false
8383
t.datetime "updated_at", null: false
8484
t.string "active_contributors"
85+
t.text "attachments"
8586
t.text "full_release_features"
8687
t.text "mission_accomplished"
8788
t.text "needs_pain_points_narrative"
@@ -96,9 +97,8 @@
9697
t.string "business_models", default: [], array: true
9798
t.string "legal_structures", default: [], array: true
9899
t.string "oss_license_types", default: [], array: true
99-
t.string "project_applications", default: [], array: true
100-
t.text "attachments"
101100
t.integer "progcode_coordinator_ids", default: [], array: true
101+
t.string "project_applications", default: [], array: true
102102
t.string "progcode_github_project_link"
103103
t.boolean "mission_aligned"
104104
t.string "import_errors", default: [], array: true

0 commit comments

Comments
 (0)