From c0ddf266fcf8754f2bd5910dddfa9777b16a55b0 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Fri, 17 Nov 2017 16:49:53 -0800 Subject: [PATCH] move save search button to sidebar --- .../stylesheets/common/main_layout.scss | 2 +- app/assets/stylesheets/mobile.scss | 69 ------------------- app/controllers/application_controller.rb | 1 + app/controllers/saved_searches_controller.rb | 2 +- app/views/posts/index.html.erb | 4 +- .../posts/partials/common/_search.html.erb | 11 --- .../posts/partials/index/_options.html.erb | 8 +++ 7 files changed, 13 insertions(+), 84 deletions(-) delete mode 100644 app/assets/stylesheets/mobile.scss create mode 100644 app/views/posts/partials/index/_options.html.erb diff --git a/app/assets/stylesheets/common/main_layout.scss b/app/assets/stylesheets/common/main_layout.scss index 3a96533a2..418497f1d 100644 --- a/app/assets/stylesheets/common/main_layout.scss +++ b/app/assets/stylesheets/common/main_layout.scss @@ -38,7 +38,7 @@ div#page { } input[type=text] { - width: 8em; + width: 10em; z-index: 1000; position: relative; } diff --git a/app/assets/stylesheets/mobile.scss b/app/assets/stylesheets/mobile.scss deleted file mode 100644 index 79a59e731..000000000 --- a/app/assets/stylesheets/mobile.scss +++ /dev/null @@ -1,69 +0,0 @@ -@import "common/010_reset.scss"; -@import "common/020_base.scss"; -@import "common/030_links.scss"; - -body { - padding: 5px; -} - -input[type=text], input[type=submit] { - font-size: 18pt; -} - -/* paginator */ -div.paginator { - font-size: 16pt; - font-weight: bold; - text-align: center; - - li { - display: inline; - - a, span { - padding: 3px 18px; - margin: 0 3px; - display: inline-block; - } - } -} - -/* posts/index */ -article.post-preview { - margin: 15px 0; - width: 150px; - text-align: center; - vertical-align: middle; - display: inline-block; - a { - width: 150px; - display: block; - margin: 0 auto; - } - img { - margin: 0 auto; - } -} - -/* posts/show */ -img#image { - margin-top: 5px; -} - -div#options { - margin-top: 10px; - font-size: 24pt; - font-weight: bold; -} - -div#tags { - margin-top: 30px; - - li { - margin: 10px 0; - } - - a.search-tag { - font-size: 24pt; - font-weight: bold; - } -} diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 71708b2c2..a31ac93a8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -90,6 +90,7 @@ class ApplicationController < ActionController::Base flash[:notice] = "This feature isn't available: #{@exception.message}" respond_to do |fmt| fmt.html { redirect_to :back } + fmt.js { render nothing: true, status: 501 } fmt.json { render template: "static/error", status: 501 } fmt.xml { render template: "static/error", status: 501 } end diff --git a/app/controllers/saved_searches_controller.rb b/app/controllers/saved_searches_controller.rb index 4880e8b5b..8da52410a 100644 --- a/app/controllers/saved_searches_controller.rb +++ b/app/controllers/saved_searches_controller.rb @@ -22,7 +22,7 @@ class SavedSearchesController < ApplicationController end def create - @saved_search = saved_searches.create(:query => params[:saved_search_tags], :label_string => params[:saved_search_labels]) + @saved_search = saved_searches.create!(:query => params[:saved_search_tags], :label_string => params[:saved_search_labels]) if params[:saved_search_disable_labels] CurrentUser.disable_categorized_saved_searches = true CurrentUser.save diff --git a/app/views/posts/index.html.erb b/app/views/posts/index.html.erb index 048f2ee70..ba6d4928e 100644 --- a/app/views/posts/index.html.erb +++ b/app/views/posts/index.html.erb @@ -7,13 +7,13 @@ <%= render "posts/partials/index/blacklist" %> - <%#= raw common_searches_html(CurrentUser.user) %> -

Tags

<%= @post_set.presenter.tag_list_html(self) %>
+ <%= render "posts/partials/index/options" %> + <%= render "posts/partials/index/related" %> diff --git a/app/views/posts/partials/common/_search.html.erb b/app/views/posts/partials/common/_search.html.erb index 03348670e..76c248e91 100644 --- a/app/views/posts/partials/common/_search.html.erb +++ b/app/views/posts/partials/common/_search.html.erb @@ -15,17 +15,6 @@ <% end %> <%= hidden_field_tag "ms", "1" %> <%= submit_tag "Go", :name => nil, :class => "ui-button ui-widget ui-corner-all tiny gradient" %> - <%= submit_tag "+", :id => "expand-search", "data-jq-dropdown" => "#search-dropdown", :class => "ui-button ui-widget ui-corner-all tiny gradient" %> -
- -
<% end %> diff --git a/app/views/posts/partials/index/_options.html.erb b/app/views/posts/partials/index/_options.html.erb new file mode 100644 index 000000000..31f477a4c --- /dev/null +++ b/app/views/posts/partials/index/_options.html.erb @@ -0,0 +1,8 @@ +
+

Options

+ +