From 5181c91aa71471fd142a6a717efd8117c3d93f04 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 9 Feb 2014 23:36:23 -0500 Subject: [PATCH] restyled PAQ and Request pages. --- app/assets/stylesheets/application.css | 29 +++---- app/assets/stylesheets/base.css | 84 ++++++++++++++++++- app/assets/stylesheets/maps.css.scss | 71 ++++++---------- app/controllers/maps_controller.rb | 42 +++++++--- app/views/main/paq.html.erb | 7 +- app/views/main/requestinvite.html.erb | 9 +- app/views/maps/_map.html.erb | 67 ++++++--------- app/views/maps/index.html.erb | 30 ++++++- config/routes.rb | 5 ++ .../20140210025850_add_featured_to_maps.rb | 7 ++ .../20140210031525_add_admin_to_users.rb | 7 ++ db/schema.rb | 4 +- 12 files changed, 240 insertions(+), 122 deletions(-) create mode 100644 db/migrate/20140210025850_add_featured_to_maps.rb create mode 100644 db/migrate/20140210031525_add_admin_to_users.rb diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index deed0027..6ffbde7b 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -63,9 +63,10 @@ body { background-attachment:fixed; color:#FFF; } + body.bodyFAQ { -background: #031924 url(mushroom.jpg) no-repeat center center; -background-size: cover; +/*background: #031924 url(mushroom.jpg) no-repeat center center; +background-size: cover;*/ } h1,h2,h3,h4,h5,h6 { @@ -1170,7 +1171,10 @@ left: 13px; } #cards { - height:100%; + height:100%; + width:800px; + margin:0 auto; + overflow-y:scroll; } #cards p.empty { @@ -1817,17 +1821,14 @@ font-weight: bold; /* FAQ */ #wrapper > div.FAQ { -width: 530px; -margin: -275px auto 0; +width: 700px; +margin: 0 auto; padding: 20px 0 20px 20px; background: rgba(0,0,0,0.4); color: white; -height: 510px; +height: 100%; overflow: hidden; position: relative; -left: 130px; -top: 50%; -border-radius: 5px; } .FAQ .question { @@ -1871,17 +1872,13 @@ background-image: url('/assets/MMCCicon_minimize_arrow.png') !important; /* request */ #wrapper .requestInvite { - width: 510px; - margin: -275px auto 0; + width: 700px; + margin: 0 auto; padding: 20px; background: rgba(0,0,0,0.4); color: white; - height: 510px; + height: 100%; overflow: hidden; - position: relative; - left: 130px; - top: 50%; - border-radius: 5px; } diff --git a/app/assets/stylesheets/base.css b/app/assets/stylesheets/base.css index ae162d5f..cc69049e 100644 --- a/app/assets/stylesheets/base.css +++ b/app/assets/stylesheets/base.css @@ -140,7 +140,7 @@ font-family: 'LatoLight'; border-top: 1px solid #AAAAAA; } -.CardOnGraph .linkItem { +.linkItem { float:left; min-width:40px; height:40px; @@ -383,3 +383,85 @@ font-family: 'LatoLight'; #edit_synapse .click-to-edit { margin-left: 0.3em; } + + + +/* Map Cards */ + +.map { + float:left; + display:block; + width:226px; + height:320px; + color:#FFF; + text-align: left; + overflow: visible; + background: #FFF; + border-radius:5px; + box-shadow: 6px 6px 8px rgba(0,0,0,0.4); + margin:16px; +} + +.mapCard { + display:block; + position:relative; + width:100%; + height:100%; + color:#000; + z-index: 25; +} + +.mapCard .metacodeImage { +width: 50px; +height: 50px; +position: absolute; +left: -25px; +top: -5px; +background-size: 50px 50px; +background-position: 0 0; +background-repeat: no-repeat; +} + +.mapCard .scroll { + display:block; + padding:5px 10px; +} + +.mapCard .type { + position: absolute; + color: white; + top: -22px; + right: 0; + font-weight: bold; + font-size: 20px; + line-height: 24px; +} + +.mapCard .title { + font-size:22px; + line-height:25px; + display:block; + padding:5px; + font-weight: bold; + text-align: center; +} + +.mapCard .links { + position:relative; + border-bottom: 1px solid #AAAAAA; + border-top: 1px solid #AAAAAA; +} + +.mapCard .icon { + position:absolute; + width:100%; + z-index:1; +} +.linkItem.topicCount { + background-image: url(MMCCicon_topic.png); + background-size: 22px 22px; +background-position: 0px center; +line-height: 40px; +min-width: 16px; +padding-left: 24px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/maps.css.scss b/app/assets/stylesheets/maps.css.scss index 54e84a54..ba8499a1 100644 --- a/app/assets/stylesheets/maps.css.scss +++ b/app/assets/stylesheets/maps.css.scss @@ -1,56 +1,39 @@ // Place all the styles related to the maps controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ +// explore maps page -.white_bg { - background: white !important; + +.mapOrder { + display: block; + background: #0F1519; + padding:5px 15px; + margin:5px auto 0; + font-weight: bold; + line-height: 24px; + position: relative; + width:770px; + height:25px; } -.mapdata { - color: #1A1; - font-style: italic; +.mapOrder .displaying, .mapOrder .whichMaps { + float:left; } -#MapRealtime { - display:none; +.whichMaps a { + color: white; + text-decoration: underline; + padding: 0 10px; + cursor:default; + font-weight:normal; +} +.whichMaps a.active { + text-decoration: none; + font-weight:bold; +} +.whichMaps a:hover { + text-decoration: none; } -.map { display:block; float:left; position:relative; width:175px; height:300px; padding:10px 5px 10px 35px; background: url('bg.png'); border-radius:15px; margin:30px 0 30px 50px; color:#000; } - -.map .delete {position: absolute; -top: -14px; -left: 0px; -background: none; -border: 0; -color: white; -border: none; -font-size: 14px; -margin: 0; -padding: 0; -cursor:pointer; -} - -.map .scroll { display:block; height:250px; } - -.map .type {position: absolute; -color: white; -top: -22px; -right: 0; -font-weight: bold; -font-size: 20px; -line-height: 24px;} - -.map .icon { position:absolute; top:135px; left:-25px; } - -.map .title { font-size:22px; line-height:27px; display:block; border-bottom:2px solid #000; padding-bottom:5px; } - -.map .desc { font-size:15px; font-family:Arial, Helvetica, sans-serif; } -.map .desc h3 { font-style:normal; margin-top:5px; } - -.map .link { position:absolute; width:170px; top:295px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } - -// add topic on maps pages -.selecttype { border:1px solid #000; margin-top: 20px; border-radius:15px; } -.mapspages .new_topic h3 { padding: 10px 26px; display: block; cursor: pointer; color: #2d6a5d; float:left; } \ No newline at end of file diff --git a/app/controllers/maps_controller.rb b/app/controllers/maps_controller.rb index 69350057..4f038ece 100644 --- a/app/controllers/maps_controller.rb +++ b/app/controllers/maps_controller.rb @@ -6,20 +6,42 @@ class MapsController < ApplicationController autocomplete :map, :name, :full => true, :extra_data => [:user_id] - # GET /maps - # or GET /users/:user_id/maps + # GET /maps/recent + # GET /maps/featured + # GET /maps/new + # GET /maps/mappers/:id def index - @current = current_user - - if params[:user_id] - @user = User.find(params[:user_id]) - @maps = Map.order("name ASC").visibleToUser(@current, @user) - elsif - @maps = Map.order("name ASC").visibleToUser(@current, nil) + if request.path == "/maps" + redirect_to activemaps_url and return end - respond_with(@maps,@user) + @current = current_user + @user = nil + + if request.path =="/maps/active" + @maps = Map.visibleToUser(@current, nil).sort! { |a,b| b.last_edited <=> a.last_edited } + @maps = @maps.slice(0,20) + @request = "active" + + elsif request.path =="/maps/featured" + @maps = Map.order("name ASC").find_all_by_featured(true) + @request = "featured" + + elsif request.path =="/maps/new" + @maps = Map.visibleToUser(@current, nil).sort! { |a,b| b.created_at <=> a.created_at } + @maps = @maps.slice(0,20) + @request = "new" + + elsif params[:id] # looking for maps by a mapper + @user = User.find(params[:id]) + @maps = Map.order("name ASC").visibleToUser(@current, @user) + @request = "you" if authenticated? && @user == @current + @request = "other" if authenticated? && @user != @current + + end + + respond_with(@maps, @request, @user) end # GET maps/new diff --git a/app/views/main/paq.html.erb b/app/views/main/paq.html.erb index f11c01a5..571c7029 100644 --- a/app/views/main/paq.html.erb +++ b/app/views/main/paq.html.erb @@ -7,7 +7,7 @@ <% content_for :title, "Possibly Asked Questions | Metamaps" %>

- PAQ + P(ossibly)AQ

@@ -48,15 +48,12 @@
Someone else changed my cool map (or favorite topic) without asking me...sad face :(

If your map / topic was set to Commons permission for editing, than any other logged-in user on the site will be able to make changes. We consider this a feature, not a bug, which encourages collaborative maps and an evolving collective knowledge garden. You can easily avoid unwanted changes by setting your permissions to Public, which others may still view and copy to another version if they wish. Courtesy, care, and the benefit of the doubt will go a long ways towards maintaining a happy, healthy, and productive communal atmosphere on Metamaps.cc

-
How do I "_________" on metamaps?
-

Link to our cheatsheet stuff...and manual.

-
diff --git a/app/views/maps/_map.html.erb b/app/views/maps/_map.html.erb index 1f81d3ec..b8dc9a1c 100644 --- a/app/views/maps/_map.html.erb +++ b/app/views/maps/_map.html.erb @@ -4,46 +4,33 @@ # Any list of maps uses this rendering. #%> <%= div_for map do %> - <% if map.authorize_to_edit(user) %> -
- <% end %> +
"> + +
+ + <%= best_in_place map, :name, :type => :input, :classes => 'best_in_place_name' %> + + +
+
+ <%= best_in_place map, :desc, :type => :textarea, :nil => "Click to add description.", :classes => 'best_in_place_desc' %> +
+
+
+
+
- <% if map.user == user %><%= link_to 'Delete', map_path(map), :class => 'delete', :confirm => 'Delete this map (nodes and synapses will remain)?', :method => :delete, :remote => true %><% end %> -

Map

- <%= image_tag 'map.png', :class => 'icon', :size => '50x50' %> -
-
<%= map.mk_permission %>
- <% if map.user == user %> -
-
- Permissions:  - <%= best_in_place map, :permission, :type => :select, :collection => [['commons', 'commons'], ['public','public'], ['private','private']], :classes => 'best_in_place_permission' %> -
-
-
- <% end %>
- - <%= best_in_place map, :name, :type => :input, :classes => 'best_in_place_name' %> - - - -
-
-
- Added by: <%=map.user.name %> - -
-
-
-

<%= map.topics.count %> topics and <%= map.synapses.count %> synapses

-

<%= best_in_place map, :desc, :type => :textarea, :nil => "Click to add description.", :classes => 'best_in_place_desc' %>

-
-
- - <% if map.authorize_to_edit(user) %> -
- <% end %> <% end %> diff --git a/app/views/maps/index.html.erb b/app/views/maps/index.html.erb index 4ee512a4..61d2bbe8 100644 --- a/app/views/maps/index.html.erb +++ b/app/views/maps/index.html.erb @@ -8,12 +8,34 @@

Explore Maps

+ +
+ Displaying: +
+ <% if @request == "other" %> + By <%= @user.name %> / + <% end %> + ">Recently Active / + ">Featured / + ">Newest First + <% if authenticated? %> + / ">Yours + <% end %> +
+
+
+
<% @maps.each do |map| %> <%= render map %> <% end %> - <% if @maps.empty? %> -


Shucks, there are no maps. <% if authenticated? %><%= link_to "Create one if you want.", new_map_url %><% end %>

- <% end %> +
-
+ + diff --git a/config/routes.rb b/config/routes.rb index 576bb113..31b4f8ec 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -22,6 +22,11 @@ ISSAD::Application.routes.draw do resources :synapses, except: [:index, :new, :edit, :show] match 'synapses/:id/:format', to: 'synapses#json', via: :get, as: :json + match 'maps/active', to: 'maps#index', via: :get, as: :activemaps + match 'maps/featured', to: 'maps#index', via: :get, as: :featuredmaps + match 'maps/new', to: 'maps#index', via: :get, as: :newmaps + match 'maps/mappers/:id', to: 'maps#index', via: :get, as: :usermaps + resources :maps, except: [:new, :edit] match 'maps/:id/embed', to: 'maps#embed', via: :get, as: :embed match 'maps/:id/:format', to: 'maps#json', via: :get, as: :json diff --git a/db/migrate/20140210025850_add_featured_to_maps.rb b/db/migrate/20140210025850_add_featured_to_maps.rb new file mode 100644 index 00000000..3794ea0c --- /dev/null +++ b/db/migrate/20140210025850_add_featured_to_maps.rb @@ -0,0 +1,7 @@ +class AddFeaturedToMaps < ActiveRecord::Migration + def change + add_column :maps, :featured, :boolean + Map.reset_column_information + Map.update_all(:featured => false) + end +end diff --git a/db/migrate/20140210031525_add_admin_to_users.rb b/db/migrate/20140210031525_add_admin_to_users.rb new file mode 100644 index 00000000..a0ac479d --- /dev/null +++ b/db/migrate/20140210031525_add_admin_to_users.rb @@ -0,0 +1,7 @@ +class AddAdminToUsers < ActiveRecord::Migration + def change + add_column :users, :admin, :boolean + User.reset_column_information + User.update_all(:admin => false) + end +end diff --git a/db/schema.rb b/db/schema.rb index 1be062f6..7d8c757f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130709212556) do +ActiveRecord::Schema.define(:version => 20140210031525) do create_table "mappings", :force => true do |t| t.text "category" @@ -33,6 +33,7 @@ ActiveRecord::Schema.define(:version => 20130709212556) do t.integer "user_id" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.boolean "featured" end create_table "metacodes", :force => true do |t| @@ -87,6 +88,7 @@ ActiveRecord::Schema.define(:version => 20130709212556) do t.datetime "current_sign_in_at" t.string "current_sign_in_ip" t.datetime "reset_password_sent_at" + t.boolean "admin" end add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true