diff --git a/app/assets/javascripts/metamaps/Metamaps.Backbone.js b/app/assets/javascripts/metamaps/Metamaps.Backbone.js index 61921ffb..f322ef9f 100644 --- a/app/assets/javascripts/metamaps/Metamaps.Backbone.js +++ b/app/assets/javascripts/metamaps/Metamaps.Backbone.js @@ -1,7 +1,7 @@ Metamaps.Backbone = {}; Metamaps.Backbone.Map = Backbone.Model.extend({ urlRoot: '/maps', - blacklist: ['created_at', 'updated_at', 'topics', 'synapses', 'mappings', 'mappers'], + blacklist: ['created_at', 'updated_at', 'user_name', 'topic_count', 'synapse_count', 'topics', 'synapses', 'mappings', 'mappers'], toJSON: function (options) { return _.omit(this.attributes, this.blacklist); }, @@ -57,11 +57,11 @@ Metamaps.Backbone.Map = Backbone.Model.extend({ id: this.id, name: this.get('name'), desc: this.get('desc'), - username: this.getUser().get('name'), - mkPermission: this.get("permission") ? this.get("permission").substring(0, 2) : "commons", + username: this.get('user_name'), + mkPermission: this.get("permission") ? this.get("permission").substring(0, 2) : "co", editPermission: this.authorizeToEdit(Metamaps.Active.Mapper) ? 'canEdit' : 'cannotEdit', - topicCount: this.getTopics().length, - synapseCount: this.getSynapses().length, + topicCount: this.get('topic_count'), + synapseCount: this.get('synapse_count'), createdAt: this.get('created_at') }; return obj; diff --git a/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js b/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js index 4ecec60b..dccd5b29 100644 --- a/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js +++ b/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js @@ -75,10 +75,6 @@ Metamaps.GlobalUI = { }); $('#lightbox_screen, #lightbox_close').click(self.closeLightbox); - - // hide notices after 10 seconds - $('.notice.metamaps').delay(10000).fadeOut('fast'); - $('.alert.metamaps').delay(10000).fadeOut('fast'); // initialize global backbone models and collections if (Metamaps.Active.Mapper) Metamaps.Active.Mapper = new Metamaps.Backbone.Mapper(Metamaps.Active.Mapper); diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 148c20c2..6a8411ce 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -201,15 +201,10 @@ input[type="submit"]:hover { .forgotPassword { display: block; width: 250px; - position: absolute; - left: 50%; - top: 0; - margin: 100px 0 0 -145px; - background: url(bg.png); + background-color: #E0E0E0; padding: 20px; border-radius: 5px; color: black; - border: 1px solid #000; box-shadow: 6px 6px 8px rgba(0, 0, 0, 0.4); } .centerGreyForm input[type="text"], diff --git a/app/models/map.rb b/app/models/map.rb index abac522f..2bfcd663 100644 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -32,6 +32,22 @@ end return contributors end + + def topic_count + self.topics.length + end + + def synapse_count + self.synapses.length + end + + def user_name + self.user.name + end + + def as_json(options={}) + super(:methods =>[:user_name, :topic_count, :synapse_count]) + end ##### PERMISSIONS ###### diff --git a/app/models/user.rb b/app/models/user.rb index b5921fa2..c5bb0969 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -38,6 +38,13 @@ has_many :mappings trans << '( +clone -flop ) -compose multiply -composite ' trans << ') -alpha off -compose copy_opacity -composite ' end + + def as_json(options={}) + { :name =>self.name, + :email => self.email, + :image => self.image.url + } + end if ActiveRecord::Base.connection.table_exists? 'users' codes = ActiveRecord::Base.connection.execute("SELECT code FROM users").map {|user| user["code"] } diff --git a/app/views/layouts/_account.html.erb b/app/views/layouts/_account.html.erb index d4912682..c44f0a78 100644 --- a/app/views/layouts/_account.html.erb +++ b/app/views/layouts/_account.html.erb @@ -5,7 +5,7 @@ <% if authenticated? %> <% account = current_user %> - <h3 class="accountHeader">Hello <%= account.name.split[0...1][0] %>!</h3> + <h3 class="accountHeader"><%= account.name.split[0...1][0] %></h3> <ul> <li class="accountIcon accountSettings"><%= link_to "Account", edit_user_url(account), :data => { :bypass => 'true'} %></li> @@ -38,8 +38,9 @@ <% end %> <div class="links"> <%- if devise_mapping.recoverable? && controller_name != 'passwords' %> - <%= link_to "Forgot your password?", new_password_path(resource_name) %> + <%= link_to "Forgot your password?", new_password_path(resource_name), + :data => { :bypass => 'true'} %> <% end -%> - <a href="/request">Request Invite</a> + <a href="/request" data-bypass="true">Request Invite</a> </div> <% end %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 3f4fe420..738d5c62 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -4,7 +4,8 @@ # User edit form #%> -<% content_for :title, @user.name + "'s Settings | Metamaps" %> +<% content_for :title, @user.name + "'s Settings | Metamaps" %> +<div id="yield"> <%= formula_form_for @user, url: user_url do |form| %> <h3>Edit Account</h3> <label for="user_image">Profile Picture</label> @@ -15,4 +16,5 @@ <%= form.input :password, label: "Password", class: "password", :autocomplete => :off %> <%= form.submit "Update", class: "update" %> <% end %> +</div> diff --git a/app/views/users/passwords/edit.html.erb b/app/views/users/passwords/edit.html.erb index a62d33f4..2cec4812 100644 --- a/app/views/users/passwords/edit.html.erb +++ b/app/views/users/passwords/edit.html.erb @@ -1,7 +1,6 @@ <% content_for :title, "Change Password | Metamaps" %> -<h1 class="index">Change Password</h1> - +<div id="yield"> <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put, :class => "forgotPassword centerGreyForm" }) do |f| %> <%= devise_error_messages! %> <%= f.hidden_field :reset_password_token %> @@ -17,5 +16,5 @@ <div><%= f.submit "Change my password" %></div> <% end %> - +</div> diff --git a/app/views/users/passwords/new.html.erb b/app/views/users/passwords/new.html.erb index 2fa7b099..bdd7a8bc 100644 --- a/app/views/users/passwords/new.html.erb +++ b/app/views/users/passwords/new.html.erb @@ -1,7 +1,6 @@ <% content_for :title, "Password Reset | Metamaps" %> -<h1 class="index">Password Reset</h1> - +<div id="yield"> <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post, :class => "forgotPassword centerGreyForm" }) do |f| %> <%= devise_error_messages! %> @@ -13,5 +12,6 @@ <div><%= f.submit "Send me reset password instructions" %></div> <% end %> +</div> diff --git a/app/views/users/registrations/new.html.erb b/app/views/users/registrations/new.html.erb index ec61da36..e7c08256 100644 --- a/app/views/users/registrations/new.html.erb +++ b/app/views/users/registrations/new.html.erb @@ -1,7 +1,6 @@ <% content_for :title, "Sign Up | Metamaps" %> -<h1 class="index">Sign Up</h1> - +<div id="yield"> <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :post, :class => "new_user centerGreyForm" }) do |f| %> <%= devise_error_messages! %> @@ -24,7 +23,7 @@ <div><%= f.submit "Sign up" %></div> - <div><br />Don't have an access code?<br /><a href="/request">Request an Invite</a></div> + <div><br />Don't have an access code?<br /><a href="/request" data-bypass="true">Request an Invite</a></div> <% end %> - +</div> diff --git a/app/views/users/sessions/new.html.erb b/app/views/users/sessions/new.html.erb index ef9866f5..6f55203b 100644 --- a/app/views/users/sessions/new.html.erb +++ b/app/views/users/sessions/new.html.erb @@ -1,7 +1,6 @@ <% content_for :title, "Sign In | Metamaps" %> -<h1 class="index">Sign In</h1> - +<div id="yield"> <%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :method => :post, :class => "new_user centerGreyForm" }) do |f| %> <h3>Sign in</h3> @@ -19,10 +18,11 @@ <br /> <%- if devise_mapping.recoverable? && controller_name != 'passwords' %> - <%= link_to "Forgot your password?", new_password_path(resource_name) %><br /> + <%= link_to "Forgot your password?", new_password_path(resource_name), + :data => { :bypass => 'true'} %><br /> <% end -%> <br /> - <div>Don't have an account?<br /><a href="/request">Request an Invite</a></div> + <div>Don't have an account?<br /><a href="/request" data-bypass="true">Request an Invite</a></div> <% end %> - +</div> diff --git a/public/famous/main.js b/public/famous/main.js index 3a8c0f91..beaf6bca 100644 --- a/public/famous/main.js +++ b/public/famous/main.js @@ -100,10 +100,12 @@ define(function(require, exports, module) { f.loadYield = function () { Metamaps.Loading.loader.hide(); - var yield = document.getElementById('yield').innerHTML; - f.yield.surf.setContent(yield); - f.yield.surf.deploy(f.yield.surf._currTarget); - f.yield.show(); + var yield = document.getElementById('yield') ? document.getElementById('yield').innerHTML : false; + if (yield) { + f.yield.surf.setContent(yield); + f.yield.surf.deploy(f.yield.surf._currTarget); + f.yield.show(); + } };