From e238071e511ef5bc6b7eba6ac4f8ba39608c4bef Mon Sep 17 00:00:00 2001 From: steven-ferguson Date: Mon, 18 Nov 2013 15:36:46 -0800 Subject: [PATCH 1/8] adds integration test for adding concept --- spec/features/request_features_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/features/request_features_spec.rb b/spec/features/request_features_spec.rb index 975a024..9e70485 100644 --- a/spec/features/request_features_spec.rb +++ b/spec/features/request_features_spec.rb @@ -17,6 +17,19 @@ page.should have_content 'successfully' end + scenario 'a member creates a valid request with a concept tag' do + concept = FactoryGirl.create(:concept) + click_link 'Create a reqest' + fill_in 'meeting_request_title', with: 'need help with rails' + fill_in 'meeting_request_content', with: 'understanding the basics' + fill_in 'meeting_request_contact_info', with: 'my cell phone for sure' + click_link 'Add a concept' + choose "meeting_request_concept_#{concept.name}" + click_button 'Submit' + #####Refine this assertion + page.should have_content concept.name + end + scenario 'a member attempts to create an invalid request' do click_link 'Create a request' click_button 'Submit' From acfe007e094a89f7d48ac7a92863581953fe6819 Mon Sep 17 00:00:00 2001 From: steven-ferguson Date: Mon, 18 Nov 2013 18:05:33 -0800 Subject: [PATCH 2/8] adds concept tagging when editing request --- .../meeting_requests_controller.rb | 2 +- .../meeting_requests/_request_form.html.erb | 28 +++++++++++++++---- app/views/meeting_requests/show.html.erb | 7 +++++ spec/features/request_features_spec.rb | 25 +++++++---------- 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/app/controllers/meeting_requests_controller.rb b/app/controllers/meeting_requests_controller.rb index d84002b..befb338 100644 --- a/app/controllers/meeting_requests_controller.rb +++ b/app/controllers/meeting_requests_controller.rb @@ -58,6 +58,6 @@ def destroy private def meeting_request_params - params.require(:meeting_request).permit(:title, :content, :contact_info, :member_uuid) + params.require(:meeting_request).permit(:title, :content, :contact_info, :member_uuid, :concept_ids => []) end end \ No newline at end of file diff --git a/app/views/meeting_requests/_request_form.html.erb b/app/views/meeting_requests/_request_form.html.erb index c745498..7ab1066 100644 --- a/app/views/meeting_requests/_request_form.html.erb +++ b/app/views/meeting_requests/_request_form.html.erb @@ -12,16 +12,34 @@ <%= render 'shared/form_errors', object: @meeting_request %>
-
- <%= f.label :title %> +
+
Title
+
+
<%= f.text_field :title, class: "form-control" %>
-
- <%= f.label :contact_method, "What is the best way to contact you?" %> - <%= f.text_area :contact_info, class: "form-control meeting-contact-form" %> +
+
What is the best way to contact you?
+
+
+ <%= f.text_area :contact_info, class: "meeting-contact-form" %> +
+
+ +
+
+
Concepts Involved
+
+
+ <% Concept.all.each do |concept| %> + + <% end %>
diff --git a/app/views/meeting_requests/show.html.erb b/app/views/meeting_requests/show.html.erb index 3740ec2..1293aff 100644 --- a/app/views/meeting_requests/show.html.erb +++ b/app/views/meeting_requests/show.html.erb @@ -5,6 +5,13 @@ <%= @meeting_request.title %>
+
<%= @meeting_request.created_at.strftime("%B %d, %Y") %> - <%= @member.name %> diff --git a/spec/features/request_features_spec.rb b/spec/features/request_features_spec.rb index 9e70485..95ae721 100644 --- a/spec/features/request_features_spec.rb +++ b/spec/features/request_features_spec.rb @@ -17,19 +17,6 @@ page.should have_content 'successfully' end - scenario 'a member creates a valid request with a concept tag' do - concept = FactoryGirl.create(:concept) - click_link 'Create a reqest' - fill_in 'meeting_request_title', with: 'need help with rails' - fill_in 'meeting_request_content', with: 'understanding the basics' - fill_in 'meeting_request_contact_info', with: 'my cell phone for sure' - click_link 'Add a concept' - choose "meeting_request_concept_#{concept.name}" - click_button 'Submit' - #####Refine this assertion - page.should have_content concept.name - end - scenario 'a member attempts to create an invalid request' do click_link 'Create a request' click_button 'Submit' @@ -60,14 +47,22 @@ scenario 'a member edits a request with valid information' do click_link 'Edit Request' - fill_in 'Title', with: 'new request title' + fill_in 'meeting_request_title', with: 'new request title' click_button 'Submit' page.should have_content 'new request title' end + scenario 'they add a concept tag' do + concept = FactoryGirl.create(:concept) + click_link 'Edit Request' + check(concept.name) + click_button 'Submit' + within('#related-concepts') { page.should have_content concept.name } + end + scenario 'a member attempts to edit a request with invalid information' do click_link 'Edit Request' - fill_in 'Title', with: '' + fill_in 'meeting_request_title', with: '' click_button 'Submit' page.should have_content 'error' end From 02705f10eeaf5649b8b6755488518583f4e56812 Mon Sep 17 00:00:00 2001 From: steven-ferguson Date: Tue, 19 Nov 2013 09:47:31 -0800 Subject: [PATCH 3/8] cleans up request show view --- Gemfile | 1 + Gemfile.lock | 4 +++ app/assets/stylesheets/application.css.scss | 2 ++ .../meeting_requests/_request_status.html.erb | 2 ++ app/views/meeting_requests/show.html.erb | 25 +++++++++++-------- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index d800dab..69fdfa9 100644 --- a/Gemfile +++ b/Gemfile @@ -26,6 +26,7 @@ gem 'redcarpet' gem 'pygments.rb' gem "twitter-bootstrap-rails" +gem 'bootstrap-glyphicons' gem 'asset_sync' gem 'unicorn' gem 'newrelic_rpm' diff --git a/Gemfile.lock b/Gemfile.lock index 437d196..fc56307 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,6 +34,9 @@ GEM better_errors (1.0.1) coderay (>= 1.0.0) erubis (>= 2.6.6) + bootstrap-glyphicons (0.0.1) + railties (>= 3.0) + sass (>= 3.2) builder (3.1.4) cancan (1.6.10) capistrano (2.15.5) @@ -262,6 +265,7 @@ PLATFORMS DEPENDENCIES asset_sync better_errors + bootstrap-glyphicons cancan capistrano capybara diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index a4324e5..3bb0756 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -12,6 +12,8 @@ *= require_tree . */ + @import 'bootstrap/glyphicons'; + footer { position: relative; width: 370px; diff --git a/app/views/meeting_requests/_request_status.html.erb b/app/views/meeting_requests/_request_status.html.erb index 53b2827..dd0d4ac 100644 --- a/app/views/meeting_requests/_request_status.html.erb +++ b/app/views/meeting_requests/_request_status.html.erb @@ -1,6 +1,7 @@ <% if current_user.is_mentor? && meeting_request.mentor_uuid.nil? %>

+ Unclaimed

@@ -41,6 +42,7 @@ <% elsif meeting_request.mentor_uuid.nil? %>

+ Unclaimed

diff --git a/app/views/meeting_requests/show.html.erb b/app/views/meeting_requests/show.html.erb index 1293aff..6e2043b 100644 --- a/app/views/meeting_requests/show.html.erb +++ b/app/views/meeting_requests/show.html.erb @@ -5,16 +5,22 @@ <%= @meeting_request.title %>

-
- <%= @meeting_request.created_at.strftime("%B %d, %Y") %> - - <%= @member.name %> +
+ <%= @meeting_request.created_at.strftime("%b %d ") %> + - <%= @member.name %> +
+
+ +
<%= simple_format(@meeting_request.content) %> @@ -47,7 +53,6 @@ <%= link_to 'Delete Request', meeting_request_path(@meeting_request), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-wide' %>
<% end %> -
\ No newline at end of file From 200e885ffb2d35247bd6a23d4c248c279642d547 Mon Sep 17 00:00:00 2001 From: steven-ferguson Date: Tue, 19 Nov 2013 09:56:53 -0800 Subject: [PATCH 4/8] adds tags on request creation --- spec/features/request_features_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/features/request_features_spec.rb b/spec/features/request_features_spec.rb index 95ae721..421f95b 100644 --- a/spec/features/request_features_spec.rb +++ b/spec/features/request_features_spec.rb @@ -17,6 +17,17 @@ page.should have_content 'successfully' end + scenario 'a member creates a valid request and tags it with concepts' do + concept = FactoryGirl.create(:concept) + click_link 'Create a request' + fill_in 'meeting_request_title', with: 'need help with rails' + fill_in 'meeting_request_content', with: 'understanding the basics' + fill_in 'meeting_request_contact_info', with: 'my cell phone for sure' + check(concept.name) + click_button 'Submit' + within('#related-concepts') { page.should have_content concept.name } + end + scenario 'a member attempts to create an invalid request' do click_link 'Create a request' click_button 'Submit' From 6ff6390c46f7095e9bbbfeeee3b79c1f895bd708 Mon Sep 17 00:00:00 2001 From: steven-ferguson Date: Tue, 19 Nov 2013 17:24:30 -0800 Subject: [PATCH 5/8] adds filtering of requests by concept --- app/assets/javascripts/meeting_requests.js | 23 ++++++ app/assets/stylesheets/layouts.css.scss | 14 ++++ app/helpers/application_helper.rb | 4 + .../_mentor_requests_index.html.erb | 23 ++++-- .../meeting_requests/_requests_list.html.erb | 30 ++++--- app/views/meeting_requests/show.html.erb | 8 +- app/views/shared/_concept_tags.html.erb | 7 ++ spec/features/request_features_spec.rb | 79 +++++++++++++------ 8 files changed, 142 insertions(+), 46 deletions(-) create mode 100644 app/assets/javascripts/meeting_requests.js create mode 100644 app/views/shared/_concept_tags.html.erb diff --git a/app/assets/javascripts/meeting_requests.js b/app/assets/javascripts/meeting_requests.js new file mode 100644 index 0000000..83a7f93 --- /dev/null +++ b/app/assets/javascripts/meeting_requests.js @@ -0,0 +1,23 @@ +$(function() { + $('.concept-search').click(function() { + $(this).toggleClass('badge-success'); + if ($('.badge-success').length === 0) { + $('.request').show(); + } else { + $('#open-requests').children('.request').hide(); + showRelated(getSelectedConceptNames()); + } + }); +}); + +function getSelectedConceptNames() { + return $('.badge-success').map(function() { + return $(this).attr('data-name').toLowerCase(); + }); +} + +function showRelated(tagNames) { + tagNames.each(function() { + $('[data-' + this + '="true"]').show(); + }); +} diff --git a/app/assets/stylesheets/layouts.css.scss b/app/assets/stylesheets/layouts.css.scss index 94be697..9a0bc5c 100644 --- a/app/assets/stylesheets/layouts.css.scss +++ b/app/assets/stylesheets/layouts.css.scss @@ -72,3 +72,17 @@ $mercury: #d1d1d1; #location-map { display: none; } + +.request { + border: solid; + margin-left: 0px; + margin-bottom: 5px; + .row { + margin: 0px; + padding: 2px; + } +} + +.concept-search { + cursor: pointer; +} diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2103104..2b363d4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -8,6 +8,10 @@ def sponsors ] end + def escape_dots(string) + string.gsub(/[.]/, '') + end + class HTMLwithPygments < Redcarpet::Render::HTML def block_code(code, language) Pygments.highlight(code, lexer:language) diff --git a/app/views/meeting_requests/_mentor_requests_index.html.erb b/app/views/meeting_requests/_mentor_requests_index.html.erb index a2da7b6..612d30f 100644 --- a/app/views/meeting_requests/_mentor_requests_index.html.erb +++ b/app/views/meeting_requests/_mentor_requests_index.html.erb @@ -1,17 +1,28 @@
-
+

My Claimed Requests

+
+
<%= render 'requests_list', meeting_requests: current_user.claimed_meeting_requests, users: @claimed_users %>
-
-

Open Requests

- <%= render 'requests_list', meeting_requests: current_user.open_meeting_requests, users: @open_users %> +
+
+

Open Requests

+
+
+ <%= render 'requests_list', meeting_requests: current_user.open_meeting_requests, users: @open_users %> +
- -
+

Concepts

+

Click on a concept to see related requests

+
    + <% Concept.all.each do |concept| %> + + <% end %> +
\ No newline at end of file diff --git a/app/views/meeting_requests/_requests_list.html.erb b/app/views/meeting_requests/_requests_list.html.erb index cbcd25f..6a2316f 100644 --- a/app/views/meeting_requests/_requests_list.html.erb +++ b/app/views/meeting_requests/_requests_list.html.erb @@ -1,16 +1,24 @@ -
    - <% meeting_requests.each do |meeting_request| %> -
  • +<% meeting_requests.each do |meeting_request| %> + <% if meeting_request.concepts.any? %> +
    + data-<%= escape_dots(concept.name) %>='true' + <% end %> + > + <% else %> +
    + <% end %>
    <%= link_to meeting_request.title, meeting_request_path(meeting_request) %>
    -
    - <%= meeting_request.created_at.strftime("%B %d, %Y") %> - <% if current_user.is_mentor? %> - | <%= users[meeting_request.member_uuid].name %> - <% end %> +
    + <%= meeting_request.created_at.strftime("%b %d") %> + - <%= users[meeting_request.member_uuid].name %> +
    +
    + <%= render 'shared/concept_tags', object: meeting_request %> +
    -
  • - <% end %> -
\ No newline at end of file +
+<% end %> diff --git a/app/views/meeting_requests/show.html.erb b/app/views/meeting_requests/show.html.erb index 6e2043b..1bf96e4 100644 --- a/app/views/meeting_requests/show.html.erb +++ b/app/views/meeting_requests/show.html.erb @@ -12,13 +12,7 @@
diff --git a/app/views/shared/_concept_tags.html.erb b/app/views/shared/_concept_tags.html.erb new file mode 100644 index 0000000..6446172 --- /dev/null +++ b/app/views/shared/_concept_tags.html.erb @@ -0,0 +1,7 @@ +<% if object.concepts.any? %> +
    + <% object.concepts.each do |concept| %> +
  • <%= link_to concept.name, concept_path(concept), class: 'label' %>
  • + <% end %> +
+<% end %> \ No newline at end of file diff --git a/spec/features/request_features_spec.rb b/spec/features/request_features_spec.rb index 421f95b..9cd3d6a 100644 --- a/spec/features/request_features_spec.rb +++ b/spec/features/request_features_spec.rb @@ -210,30 +210,65 @@ @meeting_request4 = FactoryGirl.create(:meeting_request, member_uuid: @user.uuid) end - scenario 'a member visits the page' do - stub_user_fetch_from_uuid - stub_user_fetch_from_uuids - stub_application_controller - visit meeting_requests_path - page.should_not have_content @meeting_request1.title - page.should_not have_content @meeting_request2.title - page.should have_content @meeting_request3.title - page.should have_content @meeting_request4.title + context 'as a member' do + scenario 'a member visits the page' do + stub_user_fetch_from_uuid + stub_user_fetch_from_uuids + stub_application_controller + visit meeting_requests_path + page.should_not have_content @meeting_request1.title + page.should_not have_content @meeting_request2.title + page.should have_content @meeting_request3.title + page.should have_content @meeting_request4.title + end end - scenario 'a mentor visits the page' do - @user = new_mentor - @user2 = new_member - @meeting_request1.update(mentor_uuid: @user.uuid) - @meeting_request3.update(mentor_uuid: 'other-mentor-uuid') - stub_user_fetch_from_uuid - User.stub(:fetch_from_uuids).and_return({@meeting_request3.member_uuid => @user2, @user.uuid => @user, 'member-uuid' => @user2}) - stub_application_controller - visit meeting_requests_path - page.should have_content @meeting_request1.title - page.should have_content @meeting_request2.title - page.should_not have_content @meeting_request3.title - page.should have_content @meeting_request4.title + context 'as a mentor' do + before do + @user = new_mentor + @user2 = new_member + @meeting_request1.update(mentor_uuid: @user.uuid) + @meeting_request3.update(mentor_uuid: 'other-mentor-uuid') + stub_user_fetch_from_uuid + User.stub(:fetch_from_uuids).and_return({@meeting_request3.member_uuid => @user2, @user.uuid => @user, 'member-uuid' => @user2}) + stub_application_controller + end + + scenario 'a mentor visits the page' do + visit meeting_requests_path + page.should have_content @meeting_request1.title + page.should have_content @meeting_request2.title + page.should_not have_content @meeting_request3.title + page.should have_content @meeting_request4.title + end + + scenario 'they filter requests by concepts', js: true do + concept = FactoryGirl.create(:concept) + @meeting_request4.concepts << concept + visit meeting_requests_path + within('.concepts') { find('.concept-search').click } + within('#open-requests') { page.should_not have_content @meeting_request2.title } + end + + scenario 'they unfilter requests', js: true do + concept = FactoryGirl.create(:concept) + @meeting_request4.concepts << concept + visit meeting_requests_path + within('.concepts') { find('.concept-search').click } + within('.concepts') { find('.concept-search').click } + within('#open-requests') { page.should have_content @meeting_request2.title } + end + + scenario 'they filter multiple concepts', js: true do + concept = FactoryGirl.create(:concept) + concept2 = FactoryGirl.create(:concept, name: 'Javascript') + @meeting_request4.concepts << concept + @meeting_request3.concepts << concept2 + visit meeting_requests_path + within('.concepts') { find('.concept-search:first-of-type').click } + within('.concepts') { find('.concept-search:nth-of-type(2)').click } + within('#open-requests') { page.should have_content @meeting_request4.title } + end end end From 2bbfae640b4ba917938534651cc9e9e895bfe088 Mon Sep 17 00:00:00 2001 From: steven-ferguson Date: Thu, 21 Nov 2013 16:33:38 -0800 Subject: [PATCH 6/8] removes extra rows and global js functions --- app/assets/stylesheets/layouts.css.scss | 19 ++++++++--- app/helpers/application_helper.rb | 4 +-- .../_mentor_requests_index.html.erb | 32 +++++++------------ .../meeting_requests/_requests_list.html.erb | 22 +++++-------- app/views/shared/_concept_tags.html.erb | 4 +-- 5 files changed, 39 insertions(+), 42 deletions(-) diff --git a/app/assets/stylesheets/layouts.css.scss b/app/assets/stylesheets/layouts.css.scss index 9a0bc5c..74a0e54 100644 --- a/app/assets/stylesheets/layouts.css.scss +++ b/app/assets/stylesheets/layouts.css.scss @@ -75,14 +75,25 @@ $mercury: #d1d1d1; .request { border: solid; - margin-left: 0px; + border-color: grey; margin-bottom: 5px; - .row { - margin: 0px; - padding: 2px; + padding: 2px; +} + +.no-left-margin { + margin-left: 0px; +} + +.concept { + cursor: pointer; + &:hover { + background-color: blue; } } .concept-search { cursor: pointer; + &:hover { + background-color: green; + } } diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2b363d4..e1a4a4d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -8,8 +8,8 @@ def sponsors ] end - def escape_dots(string) - string.gsub(/[.]/, '') + def escape_attribute_name(string) + string.gsub(/\W|_/, '-').downcase end class HTMLwithPygments < Redcarpet::Render::HTML diff --git a/app/views/meeting_requests/_mentor_requests_index.html.erb b/app/views/meeting_requests/_mentor_requests_index.html.erb index 612d30f..04fbbce 100644 --- a/app/views/meeting_requests/_mentor_requests_index.html.erb +++ b/app/views/meeting_requests/_mentor_requests_index.html.erb @@ -1,28 +1,20 @@ -
-
-

My Claimed Requests

-
-
- <%= render 'requests_list', meeting_requests: current_user.claimed_meeting_requests, users: @claimed_users %> -
-
- -
-
-
-

Open Requests

-
-
- <%= render 'requests_list', meeting_requests: current_user.open_meeting_requests, users: @open_users %> -
+
+

My Claimed Requests

+ <%= render 'requests_list', meeting_requests: current_user.claimed_meeting_requests, users: @claimed_users %> +
+
+
+

Open Requests

+ <%= render 'requests_list', meeting_requests: current_user.open_meeting_requests, users: @open_users %>
-

Concepts

+

Concepts

Click on a concept to see related requests

    <% Concept.all.each do |concept| %> - + <% end %>
-
\ No newline at end of file + + diff --git a/app/views/meeting_requests/_requests_list.html.erb b/app/views/meeting_requests/_requests_list.html.erb index 6a2316f..abda7bd 100644 --- a/app/views/meeting_requests/_requests_list.html.erb +++ b/app/views/meeting_requests/_requests_list.html.erb @@ -1,24 +1,18 @@ <% meeting_requests.each do |meeting_request| %> <% if meeting_request.concepts.any? %> -
- data-<%= escape_dots(concept.name) %>='true' + data-<%= escape_attribute_name(concept.name) %>='true' <% end %> > <% else %> -
+
<% end %> -
- <%= link_to meeting_request.title, meeting_request_path(meeting_request) %> -
-
-
- <%= meeting_request.created_at.strftime("%b %d") %> + <%= link_to meeting_request.title, meeting_request_path(meeting_request) %> +

+ <%= meeting_request.created_at.strftime("%b %d") %> - <%= users[meeting_request.member_uuid].name %> -

-
- <%= render 'shared/concept_tags', object: meeting_request %> -
-
+ <%= render 'shared/concept_tags', object: meeting_request %> +

<% end %> diff --git a/app/views/shared/_concept_tags.html.erb b/app/views/shared/_concept_tags.html.erb index 6446172..a9cfc58 100644 --- a/app/views/shared/_concept_tags.html.erb +++ b/app/views/shared/_concept_tags.html.erb @@ -1,7 +1,7 @@ <% if object.concepts.any? %>
    <% object.concepts.each do |concept| %> -
  • <%= link_to concept.name, concept_path(concept), class: 'label' %>
  • +
  • <%= link_to concept.name, concept_path(concept), class: 'label concept' %>
  • <% end %>
-<% end %> \ No newline at end of file +<% end %> From 48bbb37f1f45b0a513428a701f8e453e009e32c1 Mon Sep 17 00:00:00 2001 From: steven-ferguson Date: Thu, 21 Nov 2013 17:10:30 -0800 Subject: [PATCH 7/8] changes css class from concept to concept-tag --- app/assets/stylesheets/layouts.css.scss | 2 +- app/views/shared/_concept_tags.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/layouts.css.scss b/app/assets/stylesheets/layouts.css.scss index 74a0e54..b300963 100644 --- a/app/assets/stylesheets/layouts.css.scss +++ b/app/assets/stylesheets/layouts.css.scss @@ -84,7 +84,7 @@ $mercury: #d1d1d1; margin-left: 0px; } -.concept { +.concept-tag { cursor: pointer; &:hover { background-color: blue; diff --git a/app/views/shared/_concept_tags.html.erb b/app/views/shared/_concept_tags.html.erb index a9cfc58..0a0f9f6 100644 --- a/app/views/shared/_concept_tags.html.erb +++ b/app/views/shared/_concept_tags.html.erb @@ -1,7 +1,7 @@ <% if object.concepts.any? %>
    <% object.concepts.each do |concept| %> -
  • <%= link_to concept.name, concept_path(concept), class: 'label concept' %>
  • +
  • <%= link_to concept.name, concept_path(concept), class: 'label concept-tag' %>
  • <% end %>
<% end %> From e136083407918d4f9a34bdc426c0954151774f5f Mon Sep 17 00:00:00 2001 From: steven-ferguson Date: Sat, 15 Mar 2014 21:29:48 -0700 Subject: [PATCH 8/8] Update meeting_request form - Add labels - Move Concept.all call to controller --- app/controllers/meeting_requests_controller.rb | 3 +++ app/views/meeting_requests/_concept.html.erb | 1 + .../_mentor_requests_index.html.erb | 4 +--- .../meeting_requests/_request_form.html.erb | 18 ++++++++---------- app/views/meeting_requests/untitled | 0 5 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 app/views/meeting_requests/_concept.html.erb create mode 100644 app/views/meeting_requests/untitled diff --git a/app/controllers/meeting_requests_controller.rb b/app/controllers/meeting_requests_controller.rb index befb338..55a9b10 100644 --- a/app/controllers/meeting_requests_controller.rb +++ b/app/controllers/meeting_requests_controller.rb @@ -1,6 +1,7 @@ class MeetingRequestsController < ApplicationController def new @meeting_request = MeetingRequest.new(member_uuid: current_user.uuid) + @concepts = Concept.all authorize! :create, @meeting_request end @@ -17,6 +18,7 @@ def create def edit @meeting_request = MeetingRequest.find(params[:id]) + @concepts = Concept.all authorize! :update, @meeting_request end @@ -37,6 +39,7 @@ def index claimed_uuids = current_user.claimed_meeting_requests.map(&:member_uuid) @open_users = User.fetch_from_uuids(open_uuids) @claimed_users = User.fetch_from_uuids(claimed_uuids) + @concepts = Concept.all end def show diff --git a/app/views/meeting_requests/_concept.html.erb b/app/views/meeting_requests/_concept.html.erb new file mode 100644 index 0000000..e592cdc --- /dev/null +++ b/app/views/meeting_requests/_concept.html.erb @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/views/meeting_requests/_mentor_requests_index.html.erb b/app/views/meeting_requests/_mentor_requests_index.html.erb index 04fbbce..1a8aac1 100644 --- a/app/views/meeting_requests/_mentor_requests_index.html.erb +++ b/app/views/meeting_requests/_mentor_requests_index.html.erb @@ -11,9 +11,7 @@

Concepts

Click on a concept to see related requests

    - <% Concept.all.each do |concept| %> - - <% end %> + <%= render partial: "concept", collection: @concepts %>
diff --git a/app/views/meeting_requests/_request_form.html.erb b/app/views/meeting_requests/_request_form.html.erb index 7ab1066..431abd1 100644 --- a/app/views/meeting_requests/_request_form.html.erb +++ b/app/views/meeting_requests/_request_form.html.erb @@ -12,21 +12,19 @@ <%= render 'shared/form_errors', object: @meeting_request %>
-
-
Title
-
+
+ <%= f.label :title, 'Title' %>
<%= f.text_field :title, class: "form-control" %>
-
-
What is the best way to contact you?
-
-
- <%= f.text_area :contact_info, class: "meeting-contact-form" %> -
+
+ <%= f.label :contact_info, 'What is the best way to contact you?' %> +
+ <%= f.text_area :contact_info, class: "meeting-contact-form" %> +
@@ -34,7 +32,7 @@
Concepts Involved
- <% Concept.all.each do |concept| %> + <% @concepts.each do |concept| %>