Skip to content

Commit

Permalink
added javascript function for locking
Browse files Browse the repository at this point in the history
  • Loading branch information
Manasa2850 committed Jun 2, 2021
1 parent 52a981b commit 58e59b8
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/tagging.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function promptTag(val) {
break;

default:
addTag(expr);
addTag(val);
break;

}
Expand Down
6 changes: 0 additions & 6 deletions app/controllers/notes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,6 @@ def preview
render template: 'notes/show'
end

def lock_note
@node = Node.find(params[:id])
@node.add_tag('locked', current_user)
redirect_to URI.parse(@node.path).path
end

def edit
@node = Node.find_by(nid: params[:id], type: 'note')

Expand Down
2 changes: 1 addition & 1 deletion app/views/notes/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<% end %>
<% if current_user && ( current_user.role == "admin" || current_user.role == "moderator") && !(@node.has_tag('locked')) %>
<%= link_to "Lock Note", "/notes/lock_note/#{@node.id}" %>
<a href="javascript:window.location.reload(true)" onClick="addTag('locked');">Lock Note</a>
<% end %>
<% if current_user &&
Expand Down
1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@
get 'admin/publish_comment/:id' => 'admin#publish_comment'
get 'admin/mark_comment_spam/:id' => 'admin#mark_comment_spam'
get 'smtp_test' => 'admin#smtp_test'
get 'notes/lock_note/:id' => 'notes#lock_note'

get 'post' => 'editor#post', :as => :editor_post
post 'post' => 'editor#post', :as => :editor_path
Expand Down

0 comments on commit 58e59b8

Please sign in to comment.