wiki page, comment views
This commit is contained in:
@@ -4,7 +4,7 @@ class WikiPage < ActiveRecord::Base
|
||||
after_save :create_version
|
||||
belongs_to :creator, :class_name => "User"
|
||||
validates_uniqueness_of :title, :case_sensitive => false
|
||||
validates_presence_of :body
|
||||
validates_presence_of :body, :title
|
||||
validate :validate_locker_is_janitor
|
||||
attr_accessible :title, :body, :is_locked
|
||||
scope :titled, lambda {|title| where(["title = ?", title.downcase.tr(" ", "_")])}
|
||||
|
||||
6
app/views/comments/_secondary_links.html.erb
Normal file
6
app/views/comments/_secondary_links.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<% content_for(:secondary_links) do %>
|
||||
<menu>
|
||||
<li><%= link_to "Listing", comments_path(:group_by => "post") %></li>
|
||||
<li><%= link_to "Help", wiki_pages_path(:title => "help:comments") %></li>
|
||||
</menu>
|
||||
<% end %>
|
||||
@@ -9,3 +9,4 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "comments/secondary_links" %>
|
||||
@@ -5,3 +5,5 @@
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "comments/secondary_links" %>
|
||||
@@ -11,3 +11,5 @@
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "comments/secondary_links" %>
|
||||
@@ -2,7 +2,7 @@
|
||||
<div id="a-index">
|
||||
<%= render "search" %>
|
||||
|
||||
<table class="highlightable" width="100%">
|
||||
<table class="striped" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%"></th>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<%= render :partial => "wiki_pages/sidebar" %>
|
||||
|
||||
<section id="content">
|
||||
<table width="100%">
|
||||
<table width="100%" class="striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="60%">Title</th>
|
||||
|
||||
@@ -1,8 +1,27 @@
|
||||
<% if @wiki_page.new_record? || CurrentUser.is_moderator? %>
|
||||
<%= f.input :title %>
|
||||
<% end %>
|
||||
<%= f.input :body %>
|
||||
<% if CurrentUser.is_janitor? %>
|
||||
<%= f.input :is_locked %>
|
||||
<% end %>
|
||||
<%= f.button :submit, "Save" %><%= f.button :submit, "Cancel" %><%= f.button :submit, "Preview" %>
|
||||
<div id="form-content">
|
||||
<%= error_messages_for("wiki_page") %>
|
||||
|
||||
<%= simple_form_for(@wiki_page) do |f| %>
|
||||
<%= f.input :title %>
|
||||
<%= f.input :body %>
|
||||
|
||||
<% if CurrentUser.is_janitor? %>
|
||||
<%= f.input :is_locked %>
|
||||
<% end %>
|
||||
|
||||
<%= f.button :submit, "Submit" %>
|
||||
<%= f.button :submit, "Preview" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="form-aside">
|
||||
<div id="preview">
|
||||
<div class="content dtext">
|
||||
|
||||
</div>
|
||||
<p><a href="#" name="toggle-preview">Hide</a></p>
|
||||
</div>
|
||||
<div id="dtext-help">
|
||||
<%= render "dtext/help" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
<div id="c-wiki-pages">
|
||||
<div id="a-edit">
|
||||
<%= render "sidebar" %>
|
||||
|
||||
|
||||
<section id="content">
|
||||
<h1 id="wiki-page-title"><%= @wiki_page.pretty_title %> (Editing)</h1>
|
||||
|
||||
<div id="preview" class="dtext">
|
||||
</div>
|
||||
|
||||
<%= simple_form_for(@wiki_page) do |f| %>
|
||||
<%= render :partial => "form", :locals => {:f => f} %>
|
||||
<% end %>
|
||||
<%= render "form" %>
|
||||
</section>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<%= render :partial => "sidebar" %>
|
||||
|
||||
<section id="content">
|
||||
<table>
|
||||
<table class="striped" width="100%">
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Last edited</th>
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
<div id="c-wiki-pages">
|
||||
<div id="a-new">
|
||||
<%= render "sidebar" %>
|
||||
|
||||
|
||||
<section id="content">
|
||||
<h1>New Wiki Page</h1>
|
||||
|
||||
<div id="preview" class="dtext">
|
||||
</div>
|
||||
|
||||
<%= simple_form_for(@wiki_page) do |f| %>
|
||||
<%= render :partial => "form", :locals => {:f => f} %>
|
||||
<% end %>
|
||||
<%= render "form" %>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1246,9 +1246,9 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
Danbooru.WikiPage.initialize_preview_link = function() {
|
||||
$("#c-wiki-pages input[value=Cancel]").click(function(e) {
|
||||
e.preventDefault();
|
||||
window.back();
|
||||
$("#c-wiki-pages #preview a[name=toggle-preview]").click(function() {
|
||||
$("#preview").toggle();
|
||||
$("#dtext-help").toggle();
|
||||
});
|
||||
|
||||
$("#c-wiki-pages input[value=Preview]").click(function(e) {
|
||||
@@ -1260,7 +1260,9 @@ $(document).ready(function() {
|
||||
body: $("#wiki_page_body").val()
|
||||
},
|
||||
success: function(data) {
|
||||
$("#preview").show().html(data);
|
||||
$("#dtext-help").hide();
|
||||
$("#preview").show();
|
||||
$("#preview .content").html(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1284,6 +1286,7 @@ $(document).ready(function() {
|
||||
$("#preview").toggle();
|
||||
$("#dtext-help").toggle();
|
||||
});
|
||||
|
||||
$("#c-forum-topics input[value=Preview]").click(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
$("#preview").toggle();
|
||||
$("#dtext-help").toggle();
|
||||
});
|
||||
|
||||
$("#c-forum-topics input[value=Preview]").click(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
}
|
||||
|
||||
Danbooru.WikiPage.initialize_preview_link = function() {
|
||||
$("#c-wiki-pages input[value=Cancel]").click(function(e) {
|
||||
e.preventDefault();
|
||||
window.back();
|
||||
$("#c-wiki-pages #preview a[name=toggle-preview]").click(function() {
|
||||
$("#preview").toggle();
|
||||
$("#dtext-help").toggle();
|
||||
});
|
||||
|
||||
$("#c-wiki-pages input[value=Preview]").click(function(e) {
|
||||
@@ -22,7 +22,9 @@
|
||||
body: $("#wiki_page_body").val()
|
||||
},
|
||||
success: function(data) {
|
||||
$("#preview").show().html(data);
|
||||
$("#dtext-help").hide();
|
||||
$("#preview").show();
|
||||
$("#preview .content").html(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -119,6 +119,11 @@ menu {
|
||||
section {
|
||||
display: block; }
|
||||
|
||||
span.error {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
color: red; }
|
||||
|
||||
span.link {
|
||||
color: #006ffa;
|
||||
cursor: pointer; }
|
||||
@@ -264,11 +269,11 @@ div#c-pools div#a-edit ul.ui-sortable {
|
||||
padding: 0.5em; }
|
||||
div#c-pools div#a-edit ul.ui-sortable li.ui-state-default {
|
||||
margin-bottom: 20px;
|
||||
width: 250px;
|
||||
width: 180px;
|
||||
background: none; }
|
||||
div#c-pools div#a-edit ul.ui-sortable li.ui-state-placeholder {
|
||||
margin-bottom: 20px;
|
||||
width: 250px;
|
||||
width: 180px;
|
||||
height: 150px;
|
||||
background: none; }
|
||||
|
||||
@@ -411,15 +416,6 @@ div#artists div#show {
|
||||
font-size: 0.8em;
|
||||
font-style: italic; }
|
||||
|
||||
/*** Wiki Pages ***/
|
||||
div#c-wiki-pages span.version {
|
||||
color: #AAA; }
|
||||
div#c-wiki-pages h1 {
|
||||
margin-bottom: 0.5em; }
|
||||
div#c-wiki-pages div#a-edit textarea, div#c-wiki-pages div#a-new textarea {
|
||||
width: 500px;
|
||||
height: 40em; }
|
||||
|
||||
/*** Users ***/
|
||||
div.users div.new {
|
||||
max-width: 60em; }
|
||||
@@ -479,7 +475,8 @@ div#c-forum-topics textarea {
|
||||
height: 40em; }
|
||||
div#c-forum-topics div#form-content {
|
||||
float: left;
|
||||
width: 500px; }
|
||||
width: 450px;
|
||||
padding-right: 1em; }
|
||||
div#c-forum-topics div#form-aside {
|
||||
float: left;
|
||||
width: 400px; }
|
||||
@@ -487,3 +484,21 @@ div#c-forum-topics div#form-aside {
|
||||
margin-top: 0.5em;
|
||||
padding-top: 0.5em;
|
||||
border-top: 1px solid #AAA; }
|
||||
|
||||
/*** Wiki Pages ***/
|
||||
div#c-wiki-pages span.version {
|
||||
color: #AAA; }
|
||||
div#c-wiki-pages div#form-content {
|
||||
float: left;
|
||||
width: 450px;
|
||||
padding-right: 1em; }
|
||||
div#c-wiki-pages div#form-aside {
|
||||
float: left;
|
||||
width: 400px; }
|
||||
div#c-wiki-pages div#form-aside div#preview > p {
|
||||
margin-top: 0.5em;
|
||||
padding-top: 0.5em;
|
||||
border-top: 1px solid #AAA; }
|
||||
div#c-wiki-pages div#a-edit textarea, div#c-wiki-pages div#a-new textarea {
|
||||
width: 400px;
|
||||
height: 40em; }
|
||||
|
||||
@@ -154,6 +154,12 @@ section {
|
||||
display: block;
|
||||
}
|
||||
|
||||
span.error {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
color: red;
|
||||
}
|
||||
|
||||
span.link {
|
||||
color: $link_color;
|
||||
cursor: pointer;
|
||||
@@ -398,13 +404,13 @@ div#c-pools {
|
||||
|
||||
li.ui-state-default {
|
||||
margin-bottom: 20px;
|
||||
width: 250px;
|
||||
width: 180px;
|
||||
background: none;
|
||||
}
|
||||
|
||||
li.ui-state-placeholder {
|
||||
margin-bottom: 20px;
|
||||
width: 250px;
|
||||
width: 180px;
|
||||
height: 150px;
|
||||
background: none;
|
||||
}
|
||||
@@ -689,28 +695,6 @@ div#artists {
|
||||
}
|
||||
|
||||
|
||||
/*** Wiki Pages ***/
|
||||
div#c-wiki-pages {
|
||||
span.version {
|
||||
color: #AAA;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
div#a-edit, div#a-new {
|
||||
textarea {
|
||||
width: 500px;
|
||||
height: 40em;
|
||||
}
|
||||
|
||||
div#preview {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*** Users ***/
|
||||
div.users {
|
||||
div.new {
|
||||
@@ -824,7 +808,8 @@ div#c-forum-topics {
|
||||
|
||||
div#form-content {
|
||||
float: left;
|
||||
width: 500px;
|
||||
width: 450px;
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
div#form-aside {
|
||||
@@ -838,3 +823,39 @@ div#c-forum-topics {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*** Wiki Pages ***/
|
||||
div#c-wiki-pages {
|
||||
span.version {
|
||||
color: #AAA;
|
||||
}
|
||||
|
||||
div#form-content {
|
||||
float: left;
|
||||
width: 450px;
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
div#form-aside {
|
||||
float: left;
|
||||
width: 400px;
|
||||
|
||||
div#preview > p {
|
||||
margin-top: 0.5em;
|
||||
padding-top: 0.5em;
|
||||
border-top: 1px solid #AAA;
|
||||
}
|
||||
}
|
||||
|
||||
div#a-edit, div#a-new {
|
||||
textarea {
|
||||
width: 400px;
|
||||
height: 40em;
|
||||
}
|
||||
|
||||
div#preview {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user