Skip to content

Commit

Permalink
minor changes and enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
ViditChitkara committed Jan 16, 2018
1 parent 624aa87 commit 5193310
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/controllers/notes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ def rsvp
redirect_to @node.path + '#comments'
end

def request_title_change
# Updates title of a wiki page, takes id and title as query string params. maps to '/node/update/title'
def update_title
node = Node.find params[:id].to_i
unless current_user && current_user.drupal_user == node.author
flash.keep[:error] = I18n.t('notes_controller.author_can_edit_note')
Expand Down
2 changes: 1 addition & 1 deletion app/views/notes/_title_suggestion.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<blockquote>
<a href="/profile/<%= user %>"><%= user %></a> is suggesting an alternative title, "<%= title %>".
<% if is_creator %>
To accept this as a new title to your post, <a href="/reset-title?id=<%= nid %>&title=<%= title %>" data-method='post'>click here</a>
To accept this as a new title to your post, <a href="/node/update/title?id=<%= nid %>&title=<%= title %>" data-method='post'>click here</a>
<% end %>
</blockquote>
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
post 'comment/create/token/:id.:format', to: 'comment#create_by_token'

get 'searches/test' => 'searches#test'
post '/reset-title' => 'notes#request_title_change'
post '/node/update/title' => 'notes#update_title'

#Search RESTful endpoints
#constraints(subdomain: 'api') do
Expand Down

0 comments on commit 5193310

Please sign in to comment.