fixes to dmail ui

This commit is contained in:
albert
2011-10-16 01:58:16 -04:00
parent a7267cf00b
commit 1e49a00150
14 changed files with 40 additions and 24 deletions

View File

@@ -20,8 +20,6 @@ div#c-wiki-pages {
}
}
div#a-edit, div#a-new {
div#preview {
}
div#preview {
}
}

View File

@@ -20,6 +20,11 @@ class DmailsController < ApplicationController
respond_with(@dmails)
end
def search
@search = Dmail.search(params[:search])
respond_with(@dmails)
end
def show
@dmail = Dmail.find(params[:id])
check_privilege(@dmail)

View File

@@ -9,7 +9,7 @@ class Dmail < ActiveRecord::Base
belongs_to :from, :class_name => "User"
after_create :update_recipient
after_create :send_dmail
attr_accessible :title, :body, :is_deleted, :to_id, :to
attr_accessible :title, :body, :is_deleted, :to_id, :to, :to_name
scope :for, lambda {|user| where(["owner_id = ?", user])}
scope :inbox, where("to_id = owner_id")
scope :sent, where("from_id = owner_id")

View File

@@ -5,6 +5,6 @@
<%= f.input :to_name, :label => "To" %>
<%= f.input :title %>
<%= f.input :body, :html_options => {:size => "50x25"} %>
<%= f.button :submit %>
<%= submit_tag "Preview" %>
<%= f.button :submit, "Send" %>
<%= submit_tag "Preview", :id => "preview-button" %>
<% end %>

View File

@@ -1,4 +1,5 @@
<tr>
<td><%= link_to dmail.to_name, user_path(dmail.to) %></td>
<td><%= link_to dmail.from_name, user_path(dmail.from) %></td>
<td><%= link_to dmail.title, dmail_path(dmail) %></td>
<td><%= compact_time(dmail.created_at) %></td>

View File

@@ -1,10 +0,0 @@
<div>
<%= simple_form_for @search do |f| %>
<%= hidden_field_tag :folder, params[:folder] %>
<%= f.input :title_contains, :required => false %>
<%= f.input :body_contains, :required => false %>
<%= f.input :to_name_equals, :required => false %>
<%= f.input :from_name_equals, :required => false %>
<%= f.button :submit %>
<% end %>
</div>

View File

@@ -3,5 +3,6 @@
<li><%= link_to "Received", dmails_path(:folder => "received") %></li>
<li><%= link_to "Sent", dmails_path(:folder => "sent") %></li>
<li><%= link_to "New", new_dmail_path %></li>
<li><%= link_to "Search", search_dmails_path %></li>
</menu>
<% end %>

View File

@@ -1,5 +1,6 @@
<tr>
<td><%= link_to dmail.to_name, user_path(dmail.from) %></td>
<td><%= link_to dmail.to_name, user_path(dmail.to) %></td>
<td><%= link_to dmail.from_name, user_path(dmail.from) %></td>
<td><%= link_to dmail.title, dmail_path(dmail) %></td>
<td><%= compact_time(dmail.created_at) %></td>
</tr>

View File

@@ -5,3 +5,4 @@
</div>
</div>
<%= render "secondary_links" %>

View File

@@ -2,9 +2,15 @@
<div id="a-index">
<h1>Messages</h1>
<%= render "search" %>
<table>
<table class="striped" width="100%">
<thead>
<tr>
<th>To</th>
<th>From</th>
<th>Subject</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<% @dmails.each do |dmail| %>
<% if params[:folder] == "sent" %>
@@ -17,3 +23,5 @@
</table>
</div>
</div>
<%= render "secondary_links" %>

View File

@@ -5,3 +5,4 @@
</div>
</div>
<%= render "secondary_links" %>

View File

@@ -1,7 +1,8 @@
<div class="c-dmails">
<div class="a-show">
<div class="dmail">
<h1><%= @dmail.title %></h1>
<h1>Show Message</h1>
<h2><%= @dmail.title %></h2>
<%= format_text(@dmail.body) %>
<p>
@@ -11,3 +12,5 @@
</div>
</div>
</div>
<%= render "secondary_links" %>

View File

@@ -2,9 +2,12 @@
<menu>
<li><%= link_to "Listing", users_path %></li>
<% unless CurrentUser.is_anonymous? %>
<% if @user %>
<li><%= link_to "Send message", new_dmail_path(:dmail => {:to_id => @user.id}) %></li>
<% end %>
<li>|</li>
<li><%= link_to "Settings", edit_user_path(CurrentUser.user) %></li>
<li><%= link_to "Profile", user_path(CurrentUser.user) %></li>
<li><%= link_to "My settings", edit_user_path(CurrentUser.user) %></li>
<li><%= link_to "My profile", user_path(CurrentUser.user) %></li>
<li>|</li>
<li><%= link_to "Sign out", session_path, :method => :delete %></li>
<% end %>

View File

@@ -52,7 +52,11 @@ Danbooru::Application.routes.draw do
get :search
end
end
resources :dmails
resources :dmails do
collection do
get :search
end
end
resource :dtext_preview, :only => [:create]
resources :favorites
resources :forum_topics