From 660168586eb3c8ecac652cf7b03b8d35915e8811 Mon Sep 17 00:00:00 2001 From: Alice Chin Date: Tue, 29 Nov 2016 15:05:34 -0800 Subject: [PATCH] AdvanceSearchDraft --- .../javascripts/advanced_search.js.coffee | 3 +++ app/assets/stylesheets/advanced_search.scss | 3 +++ app/controllers/advanced_search_controller.rb | 11 ++++++++ app/controllers/design_methods_controller.rb | 5 ++-- app/helpers/advanced_search_helper.rb | 2 ++ app/views/advanced_search/show.html.haml | 25 +++++++++++++++++++ app/views/feedbacks/untitled | 0 app/views/layouts/_sidebar.html.haml | 2 ++ config/routes.rb | 2 ++ .../advanced_search_controller_spec.rb | 12 +++++++++ spec/helpers/advanced_search_helper_spec.rb | 15 +++++++++++ .../advanced_search/show.html.haml_spec.rb | 5 ++++ 12 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 app/assets/javascripts/advanced_search.js.coffee create mode 100644 app/assets/stylesheets/advanced_search.scss create mode 100644 app/controllers/advanced_search_controller.rb create mode 100644 app/helpers/advanced_search_helper.rb create mode 100644 app/views/advanced_search/show.html.haml create mode 100644 app/views/feedbacks/untitled create mode 100644 spec/controllers/advanced_search_controller_spec.rb create mode 100644 spec/helpers/advanced_search_helper_spec.rb create mode 100644 spec/views/advanced_search/show.html.haml_spec.rb diff --git a/app/assets/javascripts/advanced_search.js.coffee b/app/assets/javascripts/advanced_search.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/advanced_search.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/advanced_search.scss b/app/assets/stylesheets/advanced_search.scss new file mode 100644 index 0000000..8d301fa --- /dev/null +++ b/app/assets/stylesheets/advanced_search.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Advanced_Search controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/advanced_search_controller.rb b/app/controllers/advanced_search_controller.rb new file mode 100644 index 0000000..7f12e7a --- /dev/null +++ b/app/controllers/advanced_search_controller.rb @@ -0,0 +1,11 @@ +class AdvancedSearchController < ApplicationController + skip_authorization_check + layout 'custom' + + def index + end + + def show + end + +end diff --git a/app/controllers/design_methods_controller.rb b/app/controllers/design_methods_controller.rb index d93a680..1c8d04d 100644 --- a/app/controllers/design_methods_controller.rb +++ b/app/controllers/design_methods_controller.rb @@ -24,7 +24,6 @@ def index end end - def new @new = true @design_method = DesignMethod.new @@ -217,7 +216,7 @@ def unclaimEditor format.html { redirect_to @design_method, notice: 'Successfully unclaimed to be editor.'} end end - + # Confirms that user is logged-in. def edit_as_signed_in_user unless signed_in? @@ -242,4 +241,6 @@ def destroy format.html { redirect_to '/design_methods', notice: 'Design method was successfully deleted.' } end end + + end diff --git a/app/helpers/advanced_search_helper.rb b/app/helpers/advanced_search_helper.rb new file mode 100644 index 0000000..7a065c9 --- /dev/null +++ b/app/helpers/advanced_search_helper.rb @@ -0,0 +1,2 @@ +module AdvancedSearchHelper +end diff --git a/app/views/advanced_search/show.html.haml b/app/views/advanced_search/show.html.haml new file mode 100644 index 0000000..febcc5d --- /dev/null +++ b/app/views/advanced_search/show.html.haml @@ -0,0 +1,25 @@ + +.h1{:style => "margin-bottom:-2%; text-align:center"}Advanced Search Page + +.panel.panel-default.login-margin.panel-primary + .panel-heading + %h3.panel-title Find Methods that have... + .panel-body + .input + Author's first name as + %input.form-control{:placeholder => "First Name", :type => "text"}/ + .input + %br/ + Author's last name as + %input.form-control{:placeholder => "Last Name", :type => "text"}/ + .input + %br/ + Title containing + %input.form-control{:placeholder => "Method Title", :type => "text"}/ + .input + %br/ + Key Words + %input.form-control{:placeholder => "Key Words", :style => "margin-bottom: 10px;", :type => "text"}/ + .row + .col-md-12 + %button.btn.btn-default.pull-right{:type => "submit"} Search diff --git a/app/views/feedbacks/untitled b/app/views/feedbacks/untitled new file mode 100644 index 0000000..e69de29 diff --git a/app/views/layouts/_sidebar.html.haml b/app/views/layouts/_sidebar.html.haml index a4f0293..be4b375 100644 --- a/app/views/layouts/_sidebar.html.haml +++ b/app/views/layouts/_sidebar.html.haml @@ -39,3 +39,5 @@ %ul.sidebar-element .category = link_to x.name, search_category_design_methods_path(x.id), :class=> "category-heading sidebar-maincategory" +%ul.sidebar-element + = link_to "Advanced Search Page", advanced_search_show_path diff --git a/config/routes.rb b/config/routes.rb index 8cb8a2e..fe9b977 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -54,4 +54,6 @@ post "search", to: "application#search" get "autocomplete_search", to: "application#search" + get "advanced_search/show" + end diff --git a/spec/controllers/advanced_search_controller_spec.rb b/spec/controllers/advanced_search_controller_spec.rb new file mode 100644 index 0000000..178de64 --- /dev/null +++ b/spec/controllers/advanced_search_controller_spec.rb @@ -0,0 +1,12 @@ +require 'rails_helper' + +RSpec.describe AdvancedSearchController, :type => :controller do + + describe "GET 'show'" do + it "returns http success" do + get 'show' + expect(response).to be_success + end + end + +end diff --git a/spec/helpers/advanced_search_helper_spec.rb b/spec/helpers/advanced_search_helper_spec.rb new file mode 100644 index 0000000..e8ccd9c --- /dev/null +++ b/spec/helpers/advanced_search_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the AdvancedSearchHelper. For example: +# +# describe AdvancedSearchHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe AdvancedSearchHelper, :type => :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/advanced_search/show.html.haml_spec.rb b/spec/views/advanced_search/show.html.haml_spec.rb new file mode 100644 index 0000000..866e447 --- /dev/null +++ b/spec/views/advanced_search/show.html.haml_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "advanced_search/show.html.haml", :type => :view do + pending "add some examples to (or delete) #{__FILE__}" +end