From c6304c6e086f9c3a064c64a058759019689d358b Mon Sep 17 00:00:00 2001 From: albert Date: Fri, 19 Nov 2010 16:24:17 -0500 Subject: [PATCH] views --- app/controllers/advertisements_controller.rb | 8 +- app/controllers/artists_controller.rb | 6 +- app/controllers/bans_controller.rb | 11 ++- app/controllers/comment_votes_controller.rb | 3 - app/controllers/dmails_controller.rb | 30 ++++++- app/controllers/ip_bans_controller.rb | 2 + app/controllers/static_controller.rb | 2 + app/models/dmail.rb | 47 ++++++---- app/models/user.rb | 7 +- ...nks.html.erb => _secondary_links.html.erb} | 0 app/views/advertisements/edit.html.erb | 4 +- app/views/advertisements/index.html.erb | 2 +- app/views/advertisements/new.html.erb | 4 +- app/views/advertisements/show.html.erb | 2 +- app/views/artist_versions/index.html.erb | 2 +- app/views/artists/edit.html.erb | 4 +- app/views/artists/index.html.erb | 4 +- app/views/artists/new.html.erb | 4 +- app/views/artists/show.html.erb | 2 +- app/views/bans/_form.html.erb | 8 ++ app/views/bans/_secondary_links.html.erb | 6 ++ app/views/bans/destroy.js.erb | 1 + app/views/bans/edit.html.erb | 8 ++ app/views/bans/index.html.erb | 29 ++++++ app/views/bans/new.html.erb | 8 ++ app/views/bans/show.html.erb | 12 +++ app/views/comments/index.html.erb | 2 +- app/views/dmails/_form.html.erb | 12 +++ app/views/dmails/_received.html.erb | 5 ++ app/views/dmails/_search.html.erb | 10 +++ app/views/dmails/_secondary_links.html.erb | 7 ++ app/views/dmails/_sent.html.erb | 5 ++ app/views/dmails/edit.html.erb | 2 + app/views/dmails/index.html.erb | 15 ++++ app/views/dmails/new.html.erb | 2 + app/views/favorites/index.html.erb | 0 app/views/static/access_denied.html.erb | 1 + app/views/static/site_map.html.erb | 90 +++++++++++++++++++ app/views/users/_login_header.html.erb | 15 ++++ app/views/users/_secondary_links.html.erb | 15 ++++ test/unit/dmail_test.rb | 2 +- 41 files changed, 346 insertions(+), 53 deletions(-) create mode 100644 app/controllers/ip_bans_controller.rb create mode 100644 app/controllers/static_controller.rb rename app/views/advertisements/{_secondary_nav_links.html.erb => _secondary_links.html.erb} (100%) create mode 100644 app/views/bans/_form.html.erb create mode 100644 app/views/bans/_secondary_links.html.erb create mode 100644 app/views/bans/destroy.js.erb create mode 100644 app/views/bans/edit.html.erb create mode 100644 app/views/bans/index.html.erb create mode 100644 app/views/bans/new.html.erb create mode 100644 app/views/bans/show.html.erb create mode 100644 app/views/dmails/_form.html.erb create mode 100644 app/views/dmails/_received.html.erb create mode 100644 app/views/dmails/_search.html.erb create mode 100644 app/views/dmails/_secondary_links.html.erb create mode 100644 app/views/dmails/_sent.html.erb create mode 100644 app/views/dmails/edit.html.erb create mode 100644 app/views/dmails/index.html.erb create mode 100644 app/views/dmails/new.html.erb create mode 100644 app/views/favorites/index.html.erb create mode 100644 app/views/static/access_denied.html.erb create mode 100644 app/views/static/site_map.html.erb create mode 100644 app/views/users/_login_header.html.erb create mode 100644 app/views/users/_secondary_links.html.erb diff --git a/app/controllers/advertisements_controller.rb b/app/controllers/advertisements_controller.rb index 4f2a56dc3..17272cacd 100644 --- a/app/controllers/advertisements_controller.rb +++ b/app/controllers/advertisements_controller.rb @@ -33,8 +33,7 @@ class AdvertisementsController < ApplicationController def create @advertisement = Advertisement.new(params[:advertisement]) if @advertisement.save - flash[:notice] = "Advertisement created" - redirect_to advertisement_path(@advertisement) + redirect_to advertisement_path(@advertisement), :notice => "Advertisement created" else flash[:notice] = "There were errors" render :action => "new" @@ -44,8 +43,7 @@ class AdvertisementsController < ApplicationController def update @advertisement = Advertisement.find(params[:id]) if @advertisement.update_attributes(params[:advertisement]) - flash[:notice] = "Advertisement updated" - redirect_to advertisement_path(@advertisement) + redirect_to advertisement_path(@advertisement), :notice => "Advertisement updated" else flash[:notice] = "There were errors" render :action => "edit" @@ -55,6 +53,6 @@ class AdvertisementsController < ApplicationController def destroy @advertisement = Advertisement.find(params[:id]) @advertisement.destroy - redirect_to advertisements_path + redirect_to advertisements_path, :notice => "Advertisement destroyed" end end diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb index e24ce9386..10c53b165 100644 --- a/app/controllers/artists_controller.rb +++ b/app/controllers/artists_controller.rb @@ -27,7 +27,7 @@ class ArtistsController < ApplicationController @artist = Artist.create(params[:artist]) if @artist.errors.empty? - redirect_to artist_path(@artist) + redirect_to artist_path(@artist), :notice => "Artist created" else flash[:notice] = "There were errors" render :action => "new" @@ -39,7 +39,7 @@ class ArtistsController < ApplicationController @artist.update_attributes(params[:artist]) if @artist.errors.empty? - redirect_to artist_path(@artist) + redirect_to artist_path(@artist), :notice => "Artist updated" else flash[:notice] = "There were errors" render :action => "edit" @@ -49,6 +49,6 @@ class ArtistsController < ApplicationController def revert @artist = Artist.find(params[:id]) @artist.revert_to!(params[:version]) - redirect_to artist_path(@artist) + redirect_to artist_path(@artist), :notice => "Artist updated" end end diff --git a/app/controllers/bans_controller.rb b/app/controllers/bans_controller.rb index bd48a0cfb..21228da6f 100644 --- a/app/controllers/bans_controller.rb +++ b/app/controllers/bans_controller.rb @@ -1,4 +1,6 @@ class BansController < ApplicationController + before_filter :moderator_only, :except => [:show, :index] + def new @ban = Ban.new end @@ -19,7 +21,7 @@ class BansController < ApplicationController def create @ban = Ban.new(params[:ban]) if @ban.save - redirect_to ban_path(@ban) + redirect_to ban_path(@ban), :notice => "Ban created" else render :action => "new" end @@ -28,9 +30,14 @@ class BansController < ApplicationController def update @ban = Ban.find(params[:id]) if @ban.update_attributes(params[:ban]) - redirect_to ban_path(@ban) + redirect_to ban_path(@ban), :notice => "Ban updated" else render :action => "edit" end end + + def destroy + @ban = Ban.find(params[:id]) + @ban.destroy + end end diff --git a/app/controllers/comment_votes_controller.rb b/app/controllers/comment_votes_controller.rb index f3f89ec76..c133c7a42 100644 --- a/app/controllers/comment_votes_controller.rb +++ b/app/controllers/comment_votes_controller.rb @@ -5,7 +5,4 @@ class CommentVotesController < ApplicationController rescue CommentVote::Error => x @error = x end - - def destroy - end end diff --git a/app/controllers/dmails_controller.rb b/app/controllers/dmails_controller.rb index 4bb427577..85123a8ec 100644 --- a/app/controllers/dmails_controller.rb +++ b/app/controllers/dmails_controller.rb @@ -1,13 +1,41 @@ class DmailsController < ApplicationController + respond_to :html, :xml, :json + rescue_from User::PrivilegeError, :with => "static/access_denied" + def new + @dmail = Dmail.new(params[:dmail]) + respond_width(@dmail) end def index + @search = Dmail.search(params[:search]) + @dmails = @search.paginate(:page => params[:page]) + @dmails.each {|x| check_privilege(x)} + respond_with(@dmails) end def show + @dmail = Dmail.find(params[:id]) + check_privilege(@dmail) + respond_with(@dmail) end def create - end + @dmail = Dmail.create_split(params[:dmail]) + respond_with(@dmail) + end + + def destroy + @dmail = Dmail.find(params[:id]) + check_privilege(@dmail) + @dmail.destroy + redirect_to dmails_path, :notice => "Message destroyed" + end + + private + def check_privilege(dmail) + if !dmail.visible_to?(CurrentUser.user) + raise User::PrivilegeError + end + end end diff --git a/app/controllers/ip_bans_controller.rb b/app/controllers/ip_bans_controller.rb new file mode 100644 index 000000000..89b0577d8 --- /dev/null +++ b/app/controllers/ip_bans_controller.rb @@ -0,0 +1,2 @@ +class IpBansController < ApplicationController +end diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb new file mode 100644 index 000000000..c6df11e2b --- /dev/null +++ b/app/controllers/static_controller.rb @@ -0,0 +1,2 @@ +class StaticController < ApplicationController +end diff --git a/app/models/dmail.rb b/app/models/dmail.rb index 1ce321df3..b35e003b6 100644 --- a/app/models/dmail.rb +++ b/app/models/dmail.rb @@ -3,6 +3,7 @@ class Dmail < ActiveRecord::Base validates_presence_of :from_id validates_format_of :title, :with => /\S/ validates_format_of :body, :with => /\S/ + before_validation :initialize_from_id, :on => :create belongs_to :owner, :class_name => "User" belongs_to :to, :class_name => "User" belongs_to :from, :class_name => "User" @@ -30,29 +31,33 @@ class Dmail < ActiveRecord::Base return if user.nil? self.to_id = user.id end - - def from_name=(name) - user = User.find_by_name(name) - return if user.nil? - self.from_id = user.id + + def initialize_from_id + self.from_id = CurrentUser.id end end module FactoryMethods - module ClassMethods - def create_new(dmail) - copy = dmail.clone - copy.owner_id = dmail.to_id - copy.save - - copy = dmail.clone - copy.owner_id = dmail.from_id - copy.save - end - end + extend ActiveSupport::Concern - def self.included(m) - m.extend(ClassMethods) + module ClassMethods + def create_split(params) + Dmail.transaction do + copy = Dmail.new(params) + copy.owner_id = copy.to_id + copy.save + + copy = Dmail.new(params) + copy.owner_id = CurrentUser.id + copy.save + end + end + + def new_blank + Dmail.new do |dmail| + dmail.from_id = CurrentUser.id + end + end end def build_response @@ -64,7 +69,7 @@ class Dmail < ActiveRecord::Base dmail.from_id = to_id dmail.parent_id = id end - end + end end include AddressMethods @@ -91,4 +96,8 @@ class Dmail < ActiveRecord::Base def update_recipient to.update_attribute(:has_mail, true) end + + def visible_to?(user) + user.is_moderator? || owner_id == user.id + end end diff --git a/app/models/user.rb b/app/models/user.rb index b69be08a0..260fc7470 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,6 +2,7 @@ require 'digest/sha1' class User < ActiveRecord::Base class Error < Exception ; end + class PrivilegeError < Exception ; end attr_accessor :password, :old_password, :ip_addr attr_accessible :password, :old_password, :password_confirmation, :password_hash, :email, :last_logged_in_at, :last_forum_read_at, :has_mail, :receive_email_notifications, :comment_threshold, :always_resize_images, :favorite_tags, :blacklisted_tags, :name, :ip_addr @@ -40,6 +41,8 @@ class User < ActiveRecord::Base end module NameMethods + extend ActiveSupport::Concern + module ClassMethods def name_to_id(name) Cache.get("uni:#{Cache.sanitize(name)}") do @@ -62,10 +65,6 @@ class User < ActiveRecord::Base end end - def self.included(m) - m.extend(ClassMethods) - end - def pretty_name name.tr("_", " ") end diff --git a/app/views/advertisements/_secondary_nav_links.html.erb b/app/views/advertisements/_secondary_links.html.erb similarity index 100% rename from app/views/advertisements/_secondary_nav_links.html.erb rename to app/views/advertisements/_secondary_links.html.erb diff --git a/app/views/advertisements/edit.html.erb b/app/views/advertisements/edit.html.erb index 4ea518d4f..ca4e7466b 100644 --- a/app/views/advertisements/edit.html.erb +++ b/app/views/advertisements/edit.html.erb @@ -1,3 +1,3 @@ <%= image_tag(@advertisement.image_url) %> -<%= render :partial => "form" %> -<%= render :partial => "secondary_nav_links" %> +<%= render "form" %> +<%= render "secondary_links" %> diff --git a/app/views/advertisements/index.html.erb b/app/views/advertisements/index.html.erb index 8ecabec68..12f12f269 100644 --- a/app/views/advertisements/index.html.erb +++ b/app/views/advertisements/index.html.erb @@ -42,4 +42,4 @@ -<%= render :partial => "secondary_nav_links" %> +<%= render "secondary_links" %> diff --git a/app/views/advertisements/new.html.erb b/app/views/advertisements/new.html.erb index 764c2c7a3..319fd8451 100644 --- a/app/views/advertisements/new.html.erb +++ b/app/views/advertisements/new.html.erb @@ -1,3 +1,3 @@ <%= error_messages_for :advertisement %> -<%= render :partial => "form" %> -<%= render :partial => "secondary_nav_links" %> +<%= render "form" %> +<%= render "secondary_links" %> diff --git a/app/views/advertisements/show.html.erb b/app/views/advertisements/show.html.erb index 59346be96..302d08888 100644 --- a/app/views/advertisements/show.html.erb +++ b/app/views/advertisements/show.html.erb @@ -4,4 +4,4 @@
  • Hits: <%= @advertisement.hits.between(@start_date, @end_date).count %>
  • -<%= render :partial => "secondary_nav_links" %> +<%= render "secondary_links" %> diff --git a/app/views/artist_versions/index.html.erb b/app/views/artist_versions/index.html.erb index dbc545abf..6302d7f2a 100644 --- a/app/views/artist_versions/index.html.erb +++ b/app/views/artist_versions/index.html.erb @@ -33,5 +33,5 @@ <%= will_paginate(@artist_versions) %> -<%= render :partial => "footer" %> +<%= render "artists/secondary_links" %> diff --git a/app/views/artists/edit.html.erb b/app/views/artists/edit.html.erb index 758ac5d86..0a4beb690 100644 --- a/app/views/artists/edit.html.erb +++ b/app/views/artists/edit.html.erb @@ -1,7 +1,7 @@
    - <%= render :partial => "form" %> + <%= render "form" %>
    -<%= render :partial => "secondary_links" %> +<%= render "secondary_links" %> diff --git a/app/views/artists/index.html.erb b/app/views/artists/index.html.erb index 07968e726..2a1cdb355 100644 --- a/app/views/artists/index.html.erb +++ b/app/views/artists/index.html.erb @@ -1,6 +1,6 @@
    - <%= render :partial => "search" %> + <%= render "search" %> @@ -32,6 +32,6 @@ <%= will_paginate(@artists) %> - <%= render :partial => "secondary_links" %> + <%= render "secondary_links" %> diff --git a/app/views/artists/new.html.erb b/app/views/artists/new.html.erb index 2c27eb546..0b69d7c2a 100644 --- a/app/views/artists/new.html.erb +++ b/app/views/artists/new.html.erb @@ -1,7 +1,7 @@
    - <%= render :partial => "form" %> + <%= render "form" %>
    -<%= render :partial => "secondary_links" %> +<%= render "secondary_links" %> diff --git a/app/views/artists/show.html.erb b/app/views/artists/show.html.erb index a7d021c4e..89ebfabee 100644 --- a/app/views/artists/show.html.erb +++ b/app/views/artists/show.html.erb @@ -79,6 +79,6 @@ - <%= render :partial => "secondary_links" %> + <%= render "secondary_links" %> diff --git a/app/views/bans/_form.html.erb b/app/views/bans/_form.html.erb new file mode 100644 index 000000000..85059b889 --- /dev/null +++ b/app/views/bans/_form.html.erb @@ -0,0 +1,8 @@ +<%= simple_form_for(ban) do |f| %> + <%= error_messages_for("ban") %> + + <%= f.input :user_name, :as => :string %> + <%= f.input :duration, :hint => "in days" %> + <%= f.input :reason %> + <%= f.button :submit, :value => "Ban" %> +<% end %> diff --git a/app/views/bans/_secondary_links.html.erb b/app/views/bans/_secondary_links.html.erb new file mode 100644 index 000000000..1dbfe0946 --- /dev/null +++ b/app/views/bans/_secondary_links.html.erb @@ -0,0 +1,6 @@ +<% content_for(:secondary_links) do %> + +
  • <%= link_to "Listing", bans_path %>
  • +
  • <%= link_to "Ban", new_ban_path %>
  • +
    +<% end %> diff --git a/app/views/bans/destroy.js.erb b/app/views/bans/destroy.js.erb new file mode 100644 index 000000000..ba8a50f62 --- /dev/null +++ b/app/views/bans/destroy.js.erb @@ -0,0 +1 @@ +$("#ban-<%= @ban.id %>").remove(); diff --git a/app/views/bans/edit.html.erb b/app/views/bans/edit.html.erb new file mode 100644 index 000000000..3efcdde33 --- /dev/null +++ b/app/views/bans/edit.html.erb @@ -0,0 +1,8 @@ +
    +
    +

    Edit Ban

    + <%= render "form", :locals => {:ban => @ban} %> +
    +
    + +<%= render "secondary_links" %> diff --git a/app/views/bans/index.html.erb b/app/views/bans/index.html.erb new file mode 100644 index 000000000..e6d02af8e --- /dev/null +++ b/app/views/bans/index.html.erb @@ -0,0 +1,29 @@ +
    +
    +
    + + + + + + + + + + <% @bans.each do |ban| %> + + + + + + + <% end %> + +
    UserExpiresReason
    <%= ban.user_name %><%= ban.expires_at %><%= ban.reason %> + <%= link_to "Edit", edit_ban_path(ban) %> + | <%= link_to "Delete", ban_path(ban), :method => :delete, :remote => true %> +
    +
    +
    + +<%= render "secondary_links" %> diff --git a/app/views/bans/new.html.erb b/app/views/bans/new.html.erb new file mode 100644 index 000000000..3f8b1a03a --- /dev/null +++ b/app/views/bans/new.html.erb @@ -0,0 +1,8 @@ +
    +
    +

    New Ban

    + <%= render "form", :locals => {:ban => @ban} %> +
    +
    + +<%= render "secondary_links" %> diff --git a/app/views/bans/show.html.erb b/app/views/bans/show.html.erb new file mode 100644 index 000000000..a75e157ce --- /dev/null +++ b/app/views/bans/show.html.erb @@ -0,0 +1,12 @@ +
    +
    +

    Show Ban

    +
      +
    • User: <%= @ban.user_name %>
    • +
    • Expires: <%= @ban.expires_at %>
    • +
    • Reason: <%= @ban.reason %>
    • +
    +
    +
    + +<%= render "secondary_links" %> diff --git a/app/views/comments/index.html.erb b/app/views/comments/index.html.erb index d2fb5dbf9..282a244c0 100644 --- a/app/views/comments/index.html.erb +++ b/app/views/comments/index.html.erb @@ -5,7 +5,7 @@
    <%= link_to(image_tag(post.preview_file_url), post_path(post)) %>
    - <%= render :partial => "comments/partials/index/list", :locals => {:post => post, :comments => post.comments.recent.reverse, :show_header => true} %> + <%= render "comments/partials/index/list", :locals => {:post => post, :comments => post.comments.recent.reverse, :show_header => true} %>
    <% end %> diff --git a/app/views/dmails/_form.html.erb b/app/views/dmails/_form.html.erb new file mode 100644 index 000000000..d1fcc50c2 --- /dev/null +++ b/app/views/dmails/_form.html.erb @@ -0,0 +1,12 @@ +
    +
    + +<%= simple_form_for(dmail) do |f| %> + <%= hidden_field_tag "dmail[parent_id]", dmail.parent_id || dmail.id, :id => "dmail_parent_id" %> + + <%= f.input :to_name, :label => "To" %> + <%= f.input :title %> + <%= f.input :body, :html_options => {:size => "50x25"} %> + <%= f.button :submit %> + <%= submit_tag "Preview" %> +<% end %> diff --git a/app/views/dmails/_received.html.erb b/app/views/dmails/_received.html.erb new file mode 100644 index 000000000..8d0d97c42 --- /dev/null +++ b/app/views/dmails/_received.html.erb @@ -0,0 +1,5 @@ + + <%= link_to dmail.from_name, user_path(dmail.from) %> + <%= link_to dmail.title, dmail_path(dmail) %> + <%= compact_time(dmail.created_at) %> + diff --git a/app/views/dmails/_search.html.erb b/app/views/dmails/_search.html.erb new file mode 100644 index 000000000..fc844d27a --- /dev/null +++ b/app/views/dmails/_search.html.erb @@ -0,0 +1,10 @@ +
    + <%= simple_form_for @search do |f| %> + <%= hidden_field_tag :folder, params[:folder] %> + <%= f.input :title_contains %> + <%= f.input :body_contains %> + <%= f.input :to_name_equals %> + <%= f.input :from_name_equals %> + <%= f.button :submit %> + <% end %> +
    diff --git a/app/views/dmails/_secondary_links.html.erb b/app/views/dmails/_secondary_links.html.erb new file mode 100644 index 000000000..d19d5fe18 --- /dev/null +++ b/app/views/dmails/_secondary_links.html.erb @@ -0,0 +1,7 @@ +<% content_for(:secondary_links) do %> + +
  • <%= link_to "Received", dmails_path(:folder => "received") %>
  • +
  • <%= link_to "Sent", dmails_path(:folder => "sent") %>
  • +
  • <%= link_to "New", new_dmail_path %>
  • +
    +<% end %> diff --git a/app/views/dmails/_sent.html.erb b/app/views/dmails/_sent.html.erb new file mode 100644 index 000000000..d897bba9a --- /dev/null +++ b/app/views/dmails/_sent.html.erb @@ -0,0 +1,5 @@ + + <%= link_to dmail.to_name, user_path(dmail.from) %> + <%= link_to dmail.title, dmail_path(dmail) %> + <%= compact_time(dmail.created_at) %> + diff --git a/app/views/dmails/edit.html.erb b/app/views/dmails/edit.html.erb new file mode 100644 index 000000000..54b737b50 --- /dev/null +++ b/app/views/dmails/edit.html.erb @@ -0,0 +1,2 @@ +

    Edit Message

    +<%= render "form", :locals => {:dmail => @dmail} %> diff --git a/app/views/dmails/index.html.erb b/app/views/dmails/index.html.erb new file mode 100644 index 000000000..b735480b9 --- /dev/null +++ b/app/views/dmails/index.html.erb @@ -0,0 +1,15 @@ +

    Messages

    + +<%= render "search" %> + + + + <% @dmails.each do |dmail| %> + <% if params[:folder] == "sent" %> + <%= render "sent", :locals => {:dmail => dmail} %> + <% else %> + <%= render "received", :locals => {:dmail => dmail} %> + <% end %> + <% end %> + +
    diff --git a/app/views/dmails/new.html.erb b/app/views/dmails/new.html.erb new file mode 100644 index 000000000..9f6cc8a96 --- /dev/null +++ b/app/views/dmails/new.html.erb @@ -0,0 +1,2 @@ +

    New Message

    +<%= render "form", :locals => {:dmail => @dmail} %> diff --git a/app/views/favorites/index.html.erb b/app/views/favorites/index.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/static/access_denied.html.erb b/app/views/static/access_denied.html.erb new file mode 100644 index 000000000..cd7647bcb --- /dev/null +++ b/app/views/static/access_denied.html.erb @@ -0,0 +1 @@ +

    Access Denied

    \ No newline at end of file diff --git a/app/views/static/site_map.html.erb b/app/views/static/site_map.html.erb new file mode 100644 index 000000000..6cd0afd52 --- /dev/null +++ b/app/views/static/site_map.html.erb @@ -0,0 +1,90 @@ +
    +
    +

    <%= link_to Danbooru.config.app_name, '/' %>

    +
    +
      +
    • Posts

    • +
    • <%= link_to("Help", wiki_pages_path(:title => "help:posts")) %>
    • +
    • <%= link_to("Listing", posts_path) %>
    • +
    • <%= link_to("Recent Changes", post_histories_path) %>
    • +
    • <%= link_to("Upload", new_upload_path) %>
    • +
    +
      +
    • Tools

    • +
    • <%= link_to("Bookmarklet", wiki_pages_path(:title => "help:bookmarklet")) %>
    • +
    • <%= link_to("API Documentation", wiki_pages_path(:title => "help:api")) %>
    • +
    +
      +
    • Reports

    • +
    +
    +
    +
      +
    • Tags

    • +
    • <%= link_to("Help", wiki_pages_path(:title => "help:tags")) %>
    • +
    • <%= link_to("Cheat sheet", wiki_pages_path(:title => "help:cheatsheet")) %>
    • +
    • <%= link_to("Aliases", tag_aliases_path) %>
    • +
    • <%= link_to("Implications", tag_implications_path) %>
    • +
    • <%= link_to("Listing", tags_path) %>
    • +
    +
      +
    • Notes

    • +
    • <%= link_to("Help", wiki_pages_path(:title => "help:notes")) %>
    • +
    • <%= link_to("History", note_versions_path) %>
    • +
    • <%= link_to("Listing", notes_path) %>
    • +
    +
      +
    • Artists

    • +
    • <%= link_to("Help", wiki_pages_path(:title => "help:artists")) %>
    • +
    • <%= link_to("Listing", artists_path) %>
    • +
    +
      +
    • Pools

    • +
    • <%= link_to("Help", wiki_pages_path(:title => "help:pools")) %>
    • +
    • <%= link_to("Listing", pools_path) %>
    • +
    +
    +
    +
      +
    • Comments

    • +
    • <%= link_to("Help", wiki_pages_path(:title => "help:comments")) %>
    • +
    • <%= link_to("Listing", comments_path) %>
    • +
    • <%= link_to("Trac", "http://trac.donmai.us") %>
    • +
    +
      +
    • Forum

    • +
    • <%= link_to("Help", wiki_pages_path(:title => "help:forum")) %>
    • +
    • <%= link_to("Listing", forum_topics_path) %>
    • +
    +
      +
    • Wiki

    • +
    • <%= link_to("Help", wiki_pages_path(:title => "help:wiki")) %>
    • +
    • <%= link_to("Listing", wiki_pages_path) %>
    • +
    • <%= link_to("Recent Changes", wiki_page_versions_path) %>
    • +
    +
    +
    +
      +
    • Users

    • +
    • <%= link_to("Help", wiki_pages_path(:title => "help:users")) %>
    • +
    • <%= link_to("Bans", bans_path) %>
    • +
    • <%= link_to("Listing", users_path) %>
    • + <% unless CurrentUser.nil? %> +
    • <%= link_to("Profile", user_path(CurrentUser.user)) %>
    • + <% end %> +
    • <%= link_to("Feedback", user_feedback_path) %>
    • +
    • <%= link_to("Settings", edit_user_path(CurrentUser.user)) %>
    • +
    • <%= link_to("Signup", new_user_path) %>
    • +
    • <%= link_to("Terms of Service", terms_of_service_path) %>
    • +
    + <% if CurrentUser.is_admin? %> +
      +
    • Admin

    • +
    • <%= link_to("Edit User", admin_users_edit_path) %>
    • +
    • <%= link_to("Janitor Trials", janitor_trials_path) %>
    • +
    • <%= link_to("IP Bans", ip_bans_path) %>
    • +
    + <% end %> +
    +
    +
    \ No newline at end of file diff --git a/app/views/users/_login_header.html.erb b/app/views/users/_login_header.html.erb new file mode 100644 index 000000000..64ca34f0c --- /dev/null +++ b/app/views/users/_login_header.html.erb @@ -0,0 +1,15 @@ +
    + <% if CurrentUser.is_anonymous? %> + <% form_tag(sessions_path) do %> + You are not logged in. + + <%= label_tag :name %> + <%= text_field_tag :name %> + + <%= label_tag :password %> + <%= password_field_tag :password %> + <% end %> + <% else %> + <%#= nav_link_to("My Account", user_path(CurrentUser.user)) %> + <% end %> +
    diff --git a/app/views/users/_secondary_links.html.erb b/app/views/users/_secondary_links.html.erb new file mode 100644 index 000000000..a1b35d2ac --- /dev/null +++ b/app/views/users/_secondary_links.html.erb @@ -0,0 +1,15 @@ +<% content_for(:secondary_links) do %> + +
  • <%= link_to "Listing", users_path %>
  • +
  • <%= link_to "Register", new_user_path %>
  • + <% if @user && !@user.new_record? %> +
  • |
  • +
  • <%= link_to "Edit", edit_user_path(@user) %>
  • +
  • <%= link_to "Profile", user_path(@user) %>
  • + <% end %> + <% unless CurrentUser.user.is_anonymous? %> +
  • |
  • +
  • <%= link_to "Logout", session_path(0), :method => :delete %>
  • + <% end %> +
    +<% end %> diff --git a/test/unit/dmail_test.rb b/test/unit/dmail_test.rb index 11da2592f..fab01ed07 100644 --- a/test/unit/dmail_test.rb +++ b/test/unit/dmail_test.rb @@ -47,7 +47,7 @@ class DmailTest < ActiveSupport::TestCase should "create a copy for each user" do dmail = Factory.build(:dmail) assert_difference("Dmail.count", 2) do - Dmail.create_new(dmail) + Dmail.create_split(dmail.attributes) end end