major refactoring of javascripts
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
<% if @error %>
|
||||
alert("<%= escape_javascript(@error.to_s) %>");
|
||||
<% else %>
|
||||
$("#score-for-comment-<%= @comment.id %>").html("<%= pluralize @comment.score, 'point' %>");
|
||||
<% end %>
|
||||
|
||||
@@ -6,13 +6,12 @@
|
||||
<%= time_ago_in_words(comment.created_at) %> ago
|
||||
</time>
|
||||
</p>
|
||||
<p><span class="comment-score" id="score-for-comment-<%= comment.id %>"><%= pluralize comment.score, "point" %></span></p>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div>
|
||||
<%= format_text(comment.body) %>
|
||||
</div>
|
||||
<menu>
|
||||
<menu>
|
||||
<li><span class="link">Reply</span></li>
|
||||
<% if CurrentUser.user.is_janitor? || CurrentUser.user.id == comment.creator_id %>
|
||||
<li><%= link_to "Delete", comment_path(comment.id), :confirm => "Do you really want to delete this comment?", :method => :delete %></li>
|
||||
|
||||
2
app/views/favorites/create.js.erb
Normal file
2
app/views/favorites/create.js.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
$("a#add-to-favorites").hide();
|
||||
$("a#remove-from-favorites").show();
|
||||
2
app/views/favorites/destroy.js.erb
Normal file
2
app/views/favorites/destroy.js.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
$("a#add-to-favorites").show();
|
||||
$("a#remove-from-favorites").hide();
|
||||
@@ -5,7 +5,7 @@
|
||||
<% if @pool %>
|
||||
<li>|</li>
|
||||
<li><%= link_to "Show", pool_path(@pool) %></li>
|
||||
<li><%= link_to "Search", posts_path(:tags => "pool:#{@pool.id}") %></li>
|
||||
<li><%= link_to "Posts", posts_path(:tags => "pool:#{@pool.id}") %></li>
|
||||
<li><%= link_to "Simple Edit", edit_pool_path(@pool) %></li>
|
||||
<li><%= link_to "Advanced Edit", edit_pool_path(@pool, :advanced => true) %></li>
|
||||
<% end %>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<ul>
|
||||
<%= resize_image_links(post, CurrentUser.user) %>
|
||||
<li><%= link_to "Favorite", "#", :id => "add-to-favorites" %> <%= wait_image("add-to-favorites-wait") %></li>
|
||||
<li><%= link_to "Unfavorite", "#", :id => "remove-from-favorites" %> <%= wait_image("remove-from-favorites-wait") %></li>
|
||||
<li><%= link_to "Favorite", favorite_path(post), :remote => true, :method => :post, :id => "add-to-favorites" %></li>
|
||||
<li><%= link_to "Unfavorite", favorite_path(post), :remote => true, :method => :delete, :id => "remove-from-favorites" %></li>
|
||||
<li><%= link_to "Translate", "#" %></li>
|
||||
<li><%= link_to "Unapprove", new_unapproval_path(:post_id => post.id), :id => "unapprove" %></li>
|
||||
<% if CurrentUser.is_janitor? %>
|
||||
<li><%= link_to "Approve", "#", :id => "approve" %> <%= wait_image("approve-wait") %></li>
|
||||
<li><%= link_to "Disapprove", "#", :id => "disapprove" %> <%= wait_image("disapprove-wait") %></li>
|
||||
<li><%= link_to "Approve", post_moderation_approve_path(:post_id => post.id), :remote => true, :method => :put, :id => "approve" %></li>
|
||||
<li><%= link_to "Disapprove", post_moderation_disapprove_path(:post_id => post.id), :remote => true, :method => :put, :id => "disapprove" %></li>
|
||||
<% end %>
|
||||
<% if CurrentUser.is_moderator? %>
|
||||
<li><%= link_to "Undelete", "#", :id => "undelete" %> <%= wait_image("undelete-wait") %></li>
|
||||
<li><%= link_to "Delete", "#", :id => "delete" %> <%= wait_image("delete-wait") %></li>
|
||||
<li><%= link_to "Undelete", post_moderation_undelete_path(:post_id => post.id), :remote => true, :method => :post, :id => "undelete" %></li>
|
||||
<li><%= link_to "Delete", post_moderation_delete_path(:post_id => post.id), :remote => true, :method => :post, :id => "delete" %></li>
|
||||
<% end %>
|
||||
<li><%= link_to "Pool", "#", :id => "pool" %></li>
|
||||
</ul>
|
||||
1
app/views/tag_aliases/destroy.js.erb
Normal file
1
app/views/tag_aliases/destroy.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("#tag-alias-<%= @tag_alias.id %>").remove();
|
||||
@@ -19,13 +19,13 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @tag_aliases.each do |tag_alias| %>
|
||||
<tr>
|
||||
<tr id="tag-alias-<%= tag_alias.id %>">
|
||||
<td><%= link_to tag_alias.antecedent_name, posts_path(:tags => tag_alias.antecedent_name) %> (<%= tag_alias.antecedent_tag.post_count rescue 0 %>)</td>
|
||||
<td><%= link_to tag_alias.consequent_name, posts_path(:tags => tag_alias.consequent_name) %> (<%= tag_alias.consequent_tag.post_count rescue 0 %>)</td>
|
||||
<td><%= link_to tag_alias.forum_topic_id, forum_topic_path(tag_alias.forum_topic_id) %></td>
|
||||
<td>
|
||||
<% if CurrentUser.is_admin? %>
|
||||
<%= link_to "Delete", :url => tag_alias_path(tag_alias), :remote => true, :method => :delete, :confirm => "Are you sure you want to delete this alias?" %>
|
||||
<%= link_to "Delete", tag_alias_path(tag_alias), :remote => true, :method => :delete, :confirm => "Are you sure you want to delete this alias?" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
7
app/views/tag_implications/_secondary_links.html.erb
Normal file
7
app/views/tag_implications/_secondary_links.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<% content_for(:secondary_links) do %>
|
||||
<menu>
|
||||
<li><%= link_to "Listing", tag_implications_path %></li>
|
||||
<li><%= link_to "Add", new_tag_implication_path %></li>
|
||||
<li><%= link_to "Help", wiki_pages_path(:title => "help:tag_implications") %></li>
|
||||
</menu>
|
||||
<% end %>
|
||||
1
app/views/tag_implications/destroy.js.erb
Normal file
1
app/views/tag_implications/destroy.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("#tag-implication-<%= @tag_implication.id %>").remove();
|
||||
@@ -1,95 +1,42 @@
|
||||
<div style="margin-bottom: 1em;">
|
||||
<% form_tag({:action => "index"}, :method => :get) do %>
|
||||
<%= text_field_tag "query", params[:query] %>
|
||||
<%= submit_tag "Search Implications" %>
|
||||
<%= submit_tag "Search Aliases" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% form_tag(:action => "update") do %>
|
||||
<table class="highlightable" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="1%"></th>
|
||||
<th width="19%">Predicate</th>
|
||||
<th width="20%">Consequent</th>
|
||||
<th width="60%">Reason</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<% if @current_user.is_admin_or_higher? %>
|
||||
<%= button_to_function "Select pending", "$$('.pending').each(function(x) {x.checked = true})" %>
|
||||
<%= submit_tag "Approve" %>
|
||||
<%= button_to_function "Delete", "$('reason-box').show(); $('reason').focus()" %>
|
||||
<% end %>
|
||||
|
||||
<% if @current_user.is_admin_or_higher? %>
|
||||
<%= button_to_function "Add", "$('add-box').show().scrollTo(); $('tag_implication_predicate').focus()" %>
|
||||
<% else %>
|
||||
<%= button_to_function "Add", "window.location = '/forum/new?type=impl'" %>
|
||||
<% end %>
|
||||
|
||||
<% if @current_user.is_admin_or_higher? %>
|
||||
<div id="reason-box" style="display: none; margin-top: 1em;">
|
||||
<strong>Reason:</strong>
|
||||
<%= text_field_tag "reason", "", :size => 40 %>
|
||||
<%= submit_tag "Delete" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<% @implications.each do |i| %>
|
||||
<tr class="<%= cycle 'even', 'odd' %> <%= i.is_pending? ? 'pending-tag' : nil %>">
|
||||
<td><input type="checkbox" value="1" name="implications[<%= i.id %>]" <%= i.is_pending? ? 'class="pending"' : nil %>></td>
|
||||
<td><%= link_to h(i.predicate.name), :controller => "post", :action => "index", :tags => i.predicate.name %> (<%= i.predicate.post_count %>)</td>
|
||||
<td><%= link_to h(i.consequent.name), :controller => "post", :action => "index", :tags => i.consequent.name %> (<%= i.consequent.post_count %>)</td>
|
||||
<td><%= h i.reason %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<% if @current_user.is_admin_or_higher? %>
|
||||
<div id="add-box" <% unless params[:to_name] %>style="display: none;"<% end %>>
|
||||
<% form_tag(:action => "create") do %>
|
||||
<h4>Add Implication</h4>
|
||||
<% unless @current_user.is_anonymous? %>
|
||||
<%= hidden_field_tag "tag_implication[creator_id]", @current_user.id %>
|
||||
<div id="c-tag-implications">
|
||||
<div id="a-index">
|
||||
<div class="search">
|
||||
<% form_tag(tag_implications_path, :method => :get) do %>
|
||||
<%= text_field_tag "query", params[:query] %>
|
||||
<%= submit_tag "Search Aliases" %>
|
||||
<%= submit_tag "Search Implications" %>
|
||||
<% end %>
|
||||
|
||||
<table>
|
||||
</div>
|
||||
|
||||
<table width="100%" class="highlightable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><label for="tag_implication_predicate">Predicate</label></th>
|
||||
<td><%= text_field "tag_implication", "predicate", :size => 40, :value => params[:from_name] %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label for="tag_implication_consequent">Consequent</label></th>
|
||||
<td><%= text_field "tag_implication", "consequent", :size => 40, :value => params[:to_name] %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label for="tag_implication_reason">Reason</label></th>
|
||||
<td><%= text_area "tag_implication", "reason", :size => "40x2", :value => params[:reason] %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><%= submit_tag "Submit" %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
<th width="20%">From</th>
|
||||
<th width="20%">To</th>
|
||||
<th width="20%">Reference</th>
|
||||
<th width="40%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @tag_implications.each do |tag_implication| %>
|
||||
<tr id="tag-implication-<%= tag_implication.id %>">
|
||||
<td><%= link_to tag_implication.antecedent_name, posts_path(:tags => tag_implication.antecedent_name) %> (<%= tag_implication.antecedent_tag.post_count rescue 0 %>)</td>
|
||||
<td><%= link_to tag_implication.consequent_name, posts_path(:tags => tag_implication.consequent_name) %> (<%= tag_implication.consequent_tag.post_count rescue 0 %>)</td>
|
||||
<td><%= link_to tag_implication.forum_topic_id, forum_topic_path(tag_implication.forum_topic_id) %></td>
|
||||
<td>
|
||||
<% if CurrentUser.is_admin? %>
|
||||
<%= link_to "Delete", tag_implication_path(tag_implication), :remote => true, :method => :delete, :confirm => "Are you sure you want to delete this implication?" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="paginator">
|
||||
<%= will_paginate(@implications) %>
|
||||
</div>
|
||||
|
||||
<% content_for("subnavbar") do %>
|
||||
<li><%= link_to "List", :controller => "tag_implication", :action => "index" %></li>
|
||||
<li><%= link_to "Add", :controller => "tag_implication", :action => "new" %></li>
|
||||
<li><%= link_to "Help", :controller => "help", :action => "tag_implications" %></li>
|
||||
<% end %>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
<% form_tag(:controller => "forum", :action => "create") do %>
|
||||
<p>You can create a forum thread to suggest the creation of an implication.</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th><label for="tag_implication_predicate">From</label></th>
|
||||
<td><%= text_field "tag_implication", "predicate", :size => 40 %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label for="tag_implication_consequent">To</label></th>
|
||||
<td><%= text_field "tag_implication", "consequent", :size => 40 %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label for="tag_implication_reason">Reason</label></th>
|
||||
<td><%= text_area "tag_implication", "reason", :rows => 10, :cols => 60 %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><%= submit_tag "Submit" %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
<div id="c-tag-aliases">
|
||||
<div id="a-new">
|
||||
<h1>New Tag Implication</h1>
|
||||
<%= simple_form_for(@tag_implication) do |f| %>
|
||||
<%= f.input :antecedent_name, :label => "From" %>
|
||||
<%= f.input :consequent_name, :label => "To" %>
|
||||
<%= f.input :forum_topic_id, :label => "Forum" %>
|
||||
<%= f.button :submit %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
@@ -12,7 +12,7 @@
|
||||
<tr>
|
||||
<td><%= tag.post_count %></td>
|
||||
<td class="tag-category-<%= tag.category_name %>">
|
||||
<%= link_to("?", wiki_pages_path(:search => {:title_equals => tag.name})) %>
|
||||
<%= link_to("?", wiki_pages_path(:title => tag.name)) %>
|
||||
<%= link_to(tag.name, posts_path(:tags => tag.name)) %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user