Skip to content

Commit

Permalink
fixes #48
Browse files Browse the repository at this point in the history
  • Loading branch information
bromagosa committed Aug 12, 2016
1 parent 9543f76 commit 0ca492b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

local lapis = require 'lapis'
local app = lapis.Application()
local db = require 'lapis.db'
local db = require 'lapis.db'

app:enable('etlua')
app.layout = require 'views.layout'
Expand Down
2 changes: 1 addition & 1 deletion views/carousel.etlua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
};
// The second part of the query needs to be enclosed between double commas, as SQL strings are enclosed by single ones
ajax_<%= id %>.open('GET', '/api/projects/<%= collection %>/5/' + offset_<%= id %> + "<%= '/' .. (username or '') %>?list=<%- list or '' %>&notes=<%- notes or '' %>", true);
ajax_<%= id %>.open('GET', '/api/projects/<%= collection %>/5/' + offset_<%= id %> + "<%= '/' .. (username or '') %>?list=<%= list or '' %>&notes=<%= notes or '' %>", true);
ajax_<%= id %>.send();
};
function update<%= id %>() {
Expand Down
4 changes: 2 additions & 2 deletions views/inplace.etlua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
document.getElementById('<%= id %>').classList.add('flash');
}
};
ajax_<%= id %>.open('POST', '/api/<%- path %>/update/<%- property %>');
ajax_<%= id %>.open('POST', '/api/<%= path %>/update/<%= property %>');
ajax_<%= id %>.send(document.getElementById('<%= id %>').textContent);
};
function checkKey_<%= id %> (event, element) {
Expand All @@ -21,5 +21,5 @@
contenteditable="true"
onblur="update_<%= id %>()"
onfocus="document.getElementById('<%= id %>').classList.remove('flash');"
onkeypress="checkKey_<%= id %>(event, this)"><%- content %>
onkeypress="checkKey_<%= id %>(event, this)"><%= content %>
</span>
6 changes: 3 additions & 3 deletions views/myprojects.etlua
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

element.classList.add('selected');

document.getElementById('open-button').href = "/users/<%- session.username %>/projects/" + encodeURIComponent(projectName);
document.getElementById('open-button').href = "/users/<%= session.username %>/projects/" + encodeURIComponent(projectName);
document.getElementById('share-button').innerHTML = element.children[2].textContent == '✔' ? 'Unshare' : 'Share';
};

Expand Down Expand Up @@ -132,7 +132,7 @@
selectProject();
}
};
ajax.open('GET', '/api/users/<%- session.username %>/projects/' + encodeURIComponent(currentProject) + '/delete', true);
ajax.open('GET', '/api/users/<%= session.username %>/projects/' + encodeURIComponent(currentProject) + '/delete', true);
ajax.send();
}
},
Expand All @@ -150,7 +150,7 @@
}
};

ajax.open('GET', '/api/users/<%- session.username %>/projects/' + encodeURIComponent(currentProject) + '/visibility/?ispublic=' + !isPublic, true);
ajax.open('GET', '/api/users/<%= session.username %>/projects/' + encodeURIComponent(currentProject) + '/visibility/?ispublic=' + !isPublic, true);
ajax.send();
};
</script>
Expand Down
5 changes: 3 additions & 2 deletions views/project.etlua
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<% local util = require 'lapis.util' %>
<div class="project-container">
<div class="project pure-g">
<div class="postcard pure-u-1-2">
<span class="title-text">
<%- project.projectname %>
</span>
<span class="author">by <a href="/users/<%- project.username %>"><%- project.username %></a></span>
<span class="author">by <a href="/users/<%= util.escape(project.username) %>"><%- project.username %></a></span>
<img class="big-thumbnail" src="<%= project.thumbnail %>">
<div class="stats pure-g">
<div class="pure-u-1-2">
Expand Down Expand Up @@ -36,7 +37,7 @@
<%= project.notes ~= '' and project.notes or 'This project has no notes.' %>
<% end %>
</span>
<a class="pure-button red-button" align="center" href="/run#present:Username=<%- project.username %>&ProjectName=<%- project.projectname %>">Open Project</a>
<a class="pure-button red-button" align="center" href="/run#present:Username=<%= util.escape(project.username) %>&ProjectName=<%= util.escape(project.projectname) %>">Open Project</a>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion views/topbar.etlua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<a href="#" id="menuLink1" class="pure-menu-link"><%- session.username %></a>
<ul class="pure-menu-children pure-u-3-24">
<li class="pure-menu-item"><a class="pure-menu-link" href="/myprojects">My Projects</a></li>
<li class="pure-menu-item"><a class="pure-menu-link" href="/users/<%- session.username %>">My Profile</a></li>
<li class="pure-menu-item"><a class="pure-menu-link" href="/users/<%= session.username %>">My Profile</a></li>
<li class="pure-menu-item"><a class="pure-menu-link" href="/migration">Migration</a></li>
<li class="pure-menu-item"><a class="pure-menu-link" href="/logout">Log Out</a></li>
</ul>
Expand Down

0 comments on commit 0ca492b

Please sign in to comment.