From bc7db85c8c354aca9de9157f9f28ccc775075a75 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sun, 28 Feb 2016 13:13:44 +0800 Subject: [PATCH] update map index views --- app/controllers/maps_controller.rb | 12 +++------ app/views/maps/activemaps.html.erb | 15 +++++++++++ app/views/maps/featuredmaps.html.erb | 15 +++++++++++ app/views/maps/index.html.erb | 38 ---------------------------- app/views/maps/mymaps.html.erb | 15 +++++++++++ app/views/maps/usermaps.html.erb | 18 +++++++++++++ 6 files changed, 67 insertions(+), 46 deletions(-) create mode 100644 app/views/maps/activemaps.html.erb create mode 100644 app/views/maps/featuredmaps.html.erb delete mode 100644 app/views/maps/index.html.erb create mode 100644 app/views/maps/mymaps.html.erb create mode 100644 app/views/maps/usermaps.html.erb diff --git a/app/controllers/maps_controller.rb b/app/controllers/maps_controller.rb index 80568b90..cad6d8f6 100644 --- a/app/controllers/maps_controller.rb +++ b/app/controllers/maps_controller.rb @@ -10,12 +10,11 @@ class MapsController < ApplicationController @current = current_user page = params[:page].present? ? params[:page] : 1 @maps = Map.where("maps.permission != ?", "private").order("updated_at DESC").page(page).per(20) - @request = "active" redirect_to root_url and return if authenticated? respond_to do |format| - format.html { respond_with(@maps, @request, @user) } + format.html { respond_with(@maps, @user) } format.json { render json: @maps } end end @@ -26,10 +25,9 @@ class MapsController < ApplicationController page = params[:page].present? ? params[:page] : 1 @maps = Map.where("maps.featured = ? AND maps.permission != ?", true, "private") .order("updated_at DESC").page(page).per(20) - @request = "featured" respond_to do |format| - format.html { respond_with(@maps, @request, @user) } + format.html { respond_with(@maps, @user) } format.json { render json: @maps } end end @@ -42,10 +40,9 @@ class MapsController < ApplicationController page = params[:page].present? ? params[:page] : 1 # don't need to exclude private maps because they all belong to you @maps = Map.where("maps.user_id = ?", @current.id).order("updated_at DESC").page(page).per(20) - @request = "you" respond_to do |format| - format.html { respond_with(@maps, @request, @user) } + format.html { respond_with(@maps, @user) } format.json { render json: @maps } end end @@ -56,10 +53,9 @@ class MapsController < ApplicationController page = params[:page].present? ? params[:page] : 1 @user = User.find(params[:id]) @maps = Map.where("maps.user_id = ? AND maps.permission != ?", @user.id, "private").order("updated_at DESC").page(page).per(20) - @request = "mapper" respond_to do |format| - format.html { respond_with(@maps, @request, @user) } + format.html { respond_with(@maps, @user) } format.json { render json: @maps } end end diff --git a/app/views/maps/activemaps.html.erb b/app/views/maps/activemaps.html.erb new file mode 100644 index 00000000..90156321 --- /dev/null +++ b/app/views/maps/activemaps.html.erb @@ -0,0 +1,15 @@ +<% # + # @file + # Shows a list of recently active maps + # GET /explore/active(.:format) + # %> + + diff --git a/app/views/maps/featuredmaps.html.erb b/app/views/maps/featuredmaps.html.erb new file mode 100644 index 00000000..048d23a4 --- /dev/null +++ b/app/views/maps/featuredmaps.html.erb @@ -0,0 +1,15 @@ +<% # + # @file + # Shows a list of featured maps + # GET /explore/featured(.:format) + # %> + + diff --git a/app/views/maps/index.html.erb b/app/views/maps/index.html.erb deleted file mode 100644 index 0e067a63..00000000 --- a/app/views/maps/index.html.erb +++ /dev/null @@ -1,38 +0,0 @@ -<% # - # @file - # Shows a list of all maps, or just a user's maps. - # GET /explore/active(.:format) - # GET /explore/featured(.:format) - # GET /explore/mine(.:format) - # GET /explore/mapper/:id(.:format) - # GET /maps(.:format) - # %> - - diff --git a/app/views/maps/mymaps.html.erb b/app/views/maps/mymaps.html.erb new file mode 100644 index 00000000..76a96ec1 --- /dev/null +++ b/app/views/maps/mymaps.html.erb @@ -0,0 +1,15 @@ +<% # + # @file + # Shows a list of current user's maps + # GET /explore/mine(.:format) + # %> + + diff --git a/app/views/maps/usermaps.html.erb b/app/views/maps/usermaps.html.erb new file mode 100644 index 00000000..4107fbb7 --- /dev/null +++ b/app/views/maps/usermaps.html.erb @@ -0,0 +1,18 @@ +<% # + # @file + # Shows a list of a user's maps + # GET /explore/mapper/:id(.:format) + # %> + +