diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 868009134..dc48648d6 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -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(" ", "_")])} diff --git a/app/views/comments/_secondary_links.html.erb b/app/views/comments/_secondary_links.html.erb new file mode 100644 index 000000000..94067a45b --- /dev/null +++ b/app/views/comments/_secondary_links.html.erb @@ -0,0 +1,6 @@ +<% content_for(:secondary_links) do %> + +
  • <%= link_to "Listing", comments_path(:group_by => "post") %>
  • +
  • <%= link_to "Help", wiki_pages_path(:title => "help:comments") %>
  • +
    +<% end %> diff --git a/app/views/comments/edit.html.erb b/app/views/comments/edit.html.erb index 9a071331d..54d7c0d7e 100644 --- a/app/views/comments/edit.html.erb +++ b/app/views/comments/edit.html.erb @@ -9,3 +9,4 @@ +<%= render "comments/secondary_links" %> \ No newline at end of file diff --git a/app/views/comments/index_by_comment.html.erb b/app/views/comments/index_by_comment.html.erb index d55ac72d7..26deb2fa7 100644 --- a/app/views/comments/index_by_comment.html.erb +++ b/app/views/comments/index_by_comment.html.erb @@ -5,3 +5,5 @@ <% end %> + +<%= render "comments/secondary_links" %> \ No newline at end of file diff --git a/app/views/comments/index_by_post.html.erb b/app/views/comments/index_by_post.html.erb index 2f99634fc..44058699e 100644 --- a/app/views/comments/index_by_post.html.erb +++ b/app/views/comments/index_by_post.html.erb @@ -11,3 +11,5 @@ <% end %> + +<%= render "comments/secondary_links" %> \ No newline at end of file diff --git a/app/views/pools/index.html.erb b/app/views/pools/index.html.erb index 8997ac791..d7ef608e2 100644 --- a/app/views/pools/index.html.erb +++ b/app/views/pools/index.html.erb @@ -2,7 +2,7 @@
    <%= render "search" %> - +
    diff --git a/app/views/wiki_page_versions/index.html.erb b/app/views/wiki_page_versions/index.html.erb index 857c8c3d9..d9b7c79c4 100644 --- a/app/views/wiki_page_versions/index.html.erb +++ b/app/views/wiki_page_versions/index.html.erb @@ -3,7 +3,7 @@ <%= render :partial => "wiki_pages/sidebar" %>
    -
    +
    diff --git a/app/views/wiki_pages/_form.html.erb b/app/views/wiki_pages/_form.html.erb index e9d61982d..7deb76a51 100644 --- a/app/views/wiki_pages/_form.html.erb +++ b/app/views/wiki_pages/_form.html.erb @@ -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" %> +
    + <%= 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 %> +
    + +
    +
    +
    + +
    +

    Hide

    +
    +
    + <%= render "dtext/help" %> +
    +
    diff --git a/app/views/wiki_pages/edit.html.erb b/app/views/wiki_pages/edit.html.erb index 0bb6d5f98..e6a30a2a5 100644 --- a/app/views/wiki_pages/edit.html.erb +++ b/app/views/wiki_pages/edit.html.erb @@ -1,19 +1,11 @@
    <%= render "sidebar" %> - +
    -

    <%= @wiki_page.pretty_title %> (Editing)

    - -
    -
    - - <%= simple_form_for(@wiki_page) do |f| %> - <%= render :partial => "form", :locals => {:f => f} %> - <% end %> + <%= render "form" %>
    - - <%= render "secondary_links" %>
    +<%= render "secondary_links" %> diff --git a/app/views/wiki_pages/index.html.erb b/app/views/wiki_pages/index.html.erb index 09a98d9ae..2e590b818 100644 --- a/app/views/wiki_pages/index.html.erb +++ b/app/views/wiki_pages/index.html.erb @@ -3,7 +3,7 @@ <%= render :partial => "sidebar" %>
    -
    Title
    +
    diff --git a/app/views/wiki_pages/new.html.erb b/app/views/wiki_pages/new.html.erb index 610c54f81..bc6c9c53b 100644 --- a/app/views/wiki_pages/new.html.erb +++ b/app/views/wiki_pages/new.html.erb @@ -1,16 +1,9 @@
    <%= render "sidebar" %> - +
    -

    New Wiki Page

    - -
    -
    - - <%= simple_form_for(@wiki_page) do |f| %> - <%= render :partial => "form", :locals => {:f => f} %> - <% end %> + <%= render "form" %>
    diff --git a/public/javascripts/compiled/default.js b/public/javascripts/compiled/default.js index 1ba5b1131..8cc5a97e9 100644 --- a/public/javascripts/compiled/default.js +++ b/public/javascripts/compiled/default.js @@ -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({ diff --git a/public/javascripts/src/app/forum_posts.js b/public/javascripts/src/app/forum_posts.js index a7778c1ac..6caf4e4f2 100644 --- a/public/javascripts/src/app/forum_posts.js +++ b/public/javascripts/src/app/forum_posts.js @@ -12,6 +12,7 @@ $("#preview").toggle(); $("#dtext-help").toggle(); }); + $("#c-forum-topics input[value=Preview]").click(function(e) { e.preventDefault(); $.ajax({ diff --git a/public/javascripts/src/app/wiki_pages.js b/public/javascripts/src/app/wiki_pages.js index 3caaf4730..c176eb813 100644 --- a/public/javascripts/src/app/wiki_pages.js +++ b/public/javascripts/src/app/wiki_pages.js @@ -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); } }); }); diff --git a/public/stylesheets/compiled/default.css b/public/stylesheets/compiled/default.css index bda2d146d..17812a766 100644 --- a/public/stylesheets/compiled/default.css +++ b/public/stylesheets/compiled/default.css @@ -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; } diff --git a/public/stylesheets/src/default.scss b/public/stylesheets/src/default.scss index 5ae0c7b2b..3d456646b 100644 --- a/public/stylesheets/src/default.scss +++ b/public/stylesheets/src/default.scss @@ -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 { + } + } +}
    Title Last edited