Use path helpers consistently

This commit is contained in:
Dawa Ometto
2018-10-20 00:24:15 +02:00
parent b1ac06cd5f
commit d2ea03fbb9
3 changed files with 4 additions and 3 deletions
@@ -151,7 +151,7 @@
// get form fields // get form fields
var oldAction = $('#gollum-editor form').attr('action'); var oldAction = $('#gollum-editor form').attr('action');
var $form = $($('#gollum-editor form').get(0)); var $form = $($('#gollum-editor form').get(0));
$form.attr('action', this.href || '/preview'); $form.attr('action', this.href || '<%= preview_path >');
$form.attr('target', '_blank'); $form.attr('target', '_blank');
var paths = window.location.pathname.split('/'); var paths = window.location.pathname.split('/');
$form.attr('page', paths[ paths.length - 1 ] || '') $form.attr('page', paths[ paths.length - 1 ] || '')
@@ -429,7 +429,7 @@
} }
// attempt to load the definition for this language // attempt to load the definition for this language
var script_uri = baseUrl + '/assets/editor/langs/' + markup_name + '.js'; var script_uri = '<%= assets_path %>/editor/langs/' + markup_name + '.js';
$.ajax({ $.ajax({
url: script_uri, url: script_uri,
dataType: 'script', dataType: 'script',
@@ -101,7 +101,7 @@
var id = fieldAttributes.id || 'upload'; var id = fieldAttributes.id || 'upload';
var name = fieldAttributes.name || 'file'; var name = fieldAttributes.name || 'file';
var action = fieldAttributes.action || '/upload_file'; var action = fieldAttributes.action || '<%= upload_file_path %>';
html += '<form method=post enctype="multipart/form-data" ' + html += '<form method=post enctype="multipart/form-data" ' +
'action="' + action + '" ' + 'id="' + id + '">'; 'action="' + action + '" ' + 'id="' + id + '">';
+1
View File
@@ -4,6 +4,7 @@ module Precious
module Views module Views
module RouteHelpers module RouteHelpers
ROUTES = { ROUTES = {
assets: 'assets',
'gollum' => { 'gollum' => {
last_commit_info: 'last_commit_info', last_commit_info: 'last_commit_info',
latest_changes: 'latest_changes', latest_changes: 'latest_changes',